Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,11 @@ private Map.Entry<Object, Object> readSingleMapEntry(
key = getDefaultCelValue(keyDescriptor);
}
if (value == null) {
value = getDefaultCelValue(valueDescriptor);
// Map values have no presence, so a missing message (even a wrapper) is empty, not null.
value =
valueDescriptor.getJavaType().equals(JavaType.MESSAGE)
? readMessageField(ByteString.EMPTY, valueDescriptor.getFieldProtoTypeName())
: getDefaultCelValue(valueDescriptor);
}

return new AbstractMap.SimpleImmutableEntry<>(key, value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,8 @@ private enum ReadSingleFieldTestCase {
REPEATED_INT32(TestAllTypes.REPEATED_INT32_FIELD_NUMBER, ImmutableList.of(1L, 2L)),
MAP_STRING_STRING(
TestAllTypes.MAP_STRING_STRING_FIELD_NUMBER, ImmutableMap.of("k", "v", "k2", "v2", "", "")),
MAP_STRING_INT64_WRAPPER(
TestAllTypes.MAP_STRING_INT64_WRAPPER_FIELD_NUMBER, ImmutableMap.of("", 0L)),
SPLIT_DURATION(
TestAllTypes.SINGLE_DURATION_FIELD_NUMBER, java.time.Duration.ofSeconds(10, 500));

Expand Down Expand Up @@ -521,6 +523,8 @@ public void readSingleField_skipsOtherFieldsAndDecodesTarget(
extraWireCos.writeByteArray(TestAllTypes.REPEATED_INT32_FIELD_NUMBER, new byte[0]);
extraWireCos.writeByteArray(
TestAllTypes.MAP_STRING_STRING_FIELD_NUMBER, mapEntryWithUnknownOut.toByteArray());
extraWireCos.writeByteArray(
TestAllTypes.MAP_STRING_INT64_WRAPPER_FIELD_NUMBER, mapEntryWithUnknownOut.toByteArray());
extraWireCos.flush();
ByteString bytes =
part1
Expand Down
Loading