Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Unified Diff: third_party/protobuf/java/core/src/main/java/com/google/protobuf/AbstractMessageLite.java

Issue 2600753002: Reverts third_party/protobuf: Update to HEAD (f52e188fe4) (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/protobuf/java/core/src/main/java/com/google/protobuf/AbstractMessageLite.java
diff --git a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/AbstractMessageLite.java b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/AbstractMessageLite.java
index 046030f3d5282234679c20b736f877ec57ffd117..43736dd10d4370a11f0ff87adf29030a46538173 100644
--- a/third_party/protobuf/java/core/src/main/java/com/google/protobuf/AbstractMessageLite.java
+++ b/third_party/protobuf/java/core/src/main/java/com/google/protobuf/AbstractMessageLite.java
@@ -45,10 +45,10 @@ import java.util.Collection;
*/
public abstract class AbstractMessageLite<
MessageType extends AbstractMessageLite<MessageType, BuilderType>,
- BuilderType extends AbstractMessageLite.Builder<MessageType, BuilderType>>
+ BuilderType extends AbstractMessageLite.Builder<MessageType, BuilderType>>
implements MessageLite {
protected int memoizedHashCode = 0;
-
+
@Override
public ByteString toByteString() {
try {
@@ -57,7 +57,9 @@ public abstract class AbstractMessageLite<
writeTo(out.getCodedOutput());
return out.build();
} catch (IOException e) {
- throw new RuntimeException(getSerializingExceptionMessage("ByteString"), e);
+ throw new RuntimeException(
+ "Serializing to a ByteString threw an IOException (should " +
+ "never happen).", e);
}
}
@@ -70,7 +72,9 @@ public abstract class AbstractMessageLite<
output.checkNoSpaceLeft();
return result;
} catch (IOException e) {
- throw new RuntimeException(getSerializingExceptionMessage("byte array"), e);
+ throw new RuntimeException(
+ "Serializing to a byte array threw an IOException " +
+ "(should never happen).", e);
}
}
@@ -105,11 +109,6 @@ public abstract class AbstractMessageLite<
return new UninitializedMessageException(this);
}
- private String getSerializingExceptionMessage(String target) {
- return "Serializing " + getClass().getName() + " to a " + target
- + " threw an IOException (should never happen).";
- }
-
protected static void checkByteStringIsUtf8(ByteString byteString)
throws IllegalArgumentException {
if (!byteString.isValidUtf8()) {
@@ -121,7 +120,7 @@ public abstract class AbstractMessageLite<
final Collection<? super T> list) {
Builder.addAll(values, list);
}
-
+
/**
* A partial implementation of the {@link Message.Builder} interface which
* implements as many methods of that interface as possible in terms of
@@ -157,7 +156,9 @@ public abstract class AbstractMessageLite<
} catch (InvalidProtocolBufferException e) {
throw e;
} catch (IOException e) {
- throw new RuntimeException(getReadingExceptionMessage("ByteString"), e);
+ throw new RuntimeException(
+ "Reading from a ByteString threw an IOException (should " +
+ "never happen).", e);
}
}
@@ -173,7 +174,9 @@ public abstract class AbstractMessageLite<
} catch (InvalidProtocolBufferException e) {
throw e;
} catch (IOException e) {
- throw new RuntimeException(getReadingExceptionMessage("ByteString"), e);
+ throw new RuntimeException(
+ "Reading from a ByteString threw an IOException (should " +
+ "never happen).", e);
}
}
@@ -194,7 +197,9 @@ public abstract class AbstractMessageLite<
} catch (InvalidProtocolBufferException e) {
throw e;
} catch (IOException e) {
- throw new RuntimeException(getReadingExceptionMessage("byte array"), e);
+ throw new RuntimeException(
+ "Reading from a byte array threw an IOException (should " +
+ "never happen).", e);
}
}
@@ -220,7 +225,9 @@ public abstract class AbstractMessageLite<
} catch (InvalidProtocolBufferException e) {
throw e;
} catch (IOException e) {
- throw new RuntimeException(getReadingExceptionMessage("byte array"), e);
+ throw new RuntimeException(
+ "Reading from a byte array threw an IOException (should " +
+ "never happen).", e);
}
}
@@ -314,7 +321,7 @@ public abstract class AbstractMessageLite<
return mergeDelimitedFrom(input,
ExtensionRegistryLite.getEmptyRegistry());
}
-
+
@Override
@SuppressWarnings("unchecked") // isInstance takes care of this
public BuilderType mergeFrom(final MessageLite other) {
@@ -322,17 +329,12 @@ public abstract class AbstractMessageLite<
throw new IllegalArgumentException(
"mergeFrom(MessageLite) can only merge messages of the same type.");
}
-
+
return internalMergeFrom((MessageType) other);
}
-
+
protected abstract BuilderType internalMergeFrom(MessageType message);
- private String getReadingExceptionMessage(String target) {
- return "Reading " + getClass().getName() + " from a " + target
- + " threw an IOException (should never happen).";
- }
-
/**
* Construct an UninitializedMessageException reporting missing fields in
* the given message.

Powered by Google App Engine
This is Rietveld 408576698