| Index: third_party/protobuf/java/src/main/java/com/google/protobuf/AbstractMessageLite.java
|
| ===================================================================
|
| --- third_party/protobuf/java/src/main/java/com/google/protobuf/AbstractMessageLite.java (revision 216642)
|
| +++ third_party/protobuf/java/src/main/java/com/google/protobuf/AbstractMessageLite.java (working copy)
|
| @@ -92,6 +92,14 @@
|
| }
|
|
|
| /**
|
| + * Package private helper method for AbstractParser to create
|
| + * UninitializedMessageException.
|
| + */
|
| + UninitializedMessageException newUninitializedMessageException() {
|
| + return new UninitializedMessageException(this);
|
| + }
|
| +
|
| + /**
|
| * A partial implementation of the {@link Message.Builder} interface which
|
| * implements as many methods of that interface as possible in terms of
|
| * other methods.
|
| @@ -307,10 +315,12 @@
|
| */
|
| protected static <T> void addAll(final Iterable<T> values,
|
| final Collection<? super T> list) {
|
| - for (final T value : values) {
|
| - if (value == null) {
|
| - throw new NullPointerException();
|
| - }
|
| + if (values instanceof LazyStringList) {
|
| + // For StringOrByteStringLists, check the underlying elements to avoid
|
| + // forcing conversions of ByteStrings to Strings.
|
| + checkForNullValues(((LazyStringList) values).getUnderlyingElements());
|
| + } else {
|
| + checkForNullValues(values);
|
| }
|
| if (values instanceof Collection) {
|
| final Collection<T> collection = (Collection<T>) values;
|
| @@ -321,5 +331,13 @@
|
| }
|
| }
|
| }
|
| +
|
| + private static void checkForNullValues(final Iterable<?> values) {
|
| + for (final Object value : values) {
|
| + if (value == null) {
|
| + throw new NullPointerException();
|
| + }
|
| + }
|
| + }
|
| }
|
| }
|
|
|