Skip to content

Commit

Permalink
Merge branch '2.10' into 2.11
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Apr 14, 2020
2 parents 38431a0 + 4b4b33c commit 4c1db5e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 14 deletions.
Expand Up @@ -699,7 +699,7 @@ private boolean _checkEnd() throws IOException
private JsonToken _handleRootKey(int tag) throws IOException
{
int wireType = (tag & 0x7);
int id = (tag >> 3);
final int id = (tag >> 3);

ProtobufField f;
if (_currentField != null) {
Expand Down Expand Up @@ -997,11 +997,11 @@ public boolean nextFieldName(SerializableString sstr) throws IOException
return false;
}
}
int tag = _decodeVInt();
final int tag = _decodeVInt();
// inlined _handleRootKey()

int wireType = (tag & 0x7);
int id = (tag >> 3);
final int wireType = (tag & 0x7);
final int id = (tag >> 3);

ProtobufField f = _findField(id);
if (f == null) {
Expand Down Expand Up @@ -1033,11 +1033,11 @@ public boolean nextFieldName(SerializableString sstr) throws IOException
_currToken = JsonToken.END_OBJECT;
return false;
}
int tag = _decodeVInt();
final int tag = _decodeVInt();
// inlined '_handleNestedKey()'

int wireType = (tag & 0x7);
int id = (tag >> 3);
final int wireType = (tag & 0x7);
final int id = (tag >> 3);

ProtobufField f = _findField(id);
if (f == null) {
Expand Down Expand Up @@ -1078,18 +1078,20 @@ public String nextFieldName() throws IOException
return null;
}
}
int tag = _decodeVInt();
final int tag = _decodeVInt();
// inlined _handleRootKey()

int wireType = (tag & 0x7);
int id = (tag >> 3);
final int id = (tag >> 3);

ProtobufField f = _findField(id);
if (f == null) {
if (_skipUnknownField(id, wireType) != JsonToken.FIELD_NAME) {
return null;
}
// sub-optimal as skip method already set it, but:
// [dataformats-binary#202]: need to reset after skipping
wireType = _currentField.wireType;
}
String name = _currentField.name;
_parsingContext.setCurrentName(name);
Expand All @@ -1115,18 +1117,20 @@ public String nextFieldName() throws IOException
_currToken = JsonToken.END_OBJECT;
return null;
}
int tag = _decodeVInt();
final int tag = _decodeVInt();
// inlined '_handleNestedKey()'

int wireType = (tag & 0x7);
int id = (tag >> 3);
final int id = (tag >> 3);

ProtobufField f = _findField(id);
if (f == null) {
if (_skipUnknownField(id, wireType) != JsonToken.FIELD_NAME) {
return null;
}
// sub-optimal as skip method already set it, but:
// [dataformats-binary#202]: need to reset after skipping
wireType = _currentField.wireType;
}
final String name = _currentField.name;
_parsingContext.setCurrentName(name);
Expand Down Expand Up @@ -2111,7 +2115,6 @@ protected ByteArrayBuilder _getByteArrayBuilder() {
return _byteArrayBuilder;
}

@SuppressWarnings("deprecation")
protected void _closeInput() throws IOException {
if (_inputStream != null) {
if (_ioContext.isResourceManaged() || isEnabled(JsonParser.Feature.AUTO_CLOSE_SOURCE)) {
Expand Down
@@ -1,4 +1,4 @@
package com.fasterxml.jackson.dataformat.protobuf.failing;
package com.fasterxml.jackson.dataformat.protobuf;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonParser;
Expand Down Expand Up @@ -123,7 +123,6 @@ public void testV1toV0() throws Exception {
TestMessageV0 messageV0 = MAPPER
.readerFor(TestMessageV0.class)
.with(schemaV0)
.with(JsonParser.Feature.IGNORE_UNDEFINED)
.readValue(protobufData);

assertEquals(messageV1.getId(), messageV0.getId());
Expand Down
5 changes: 5 additions & 0 deletions release-notes/VERSION-2.x
Expand Up @@ -24,6 +24,11 @@ Project: jackson-datatypes-binaryModules:
(reported by Jonas K)
- `AvroGenerator` overrides `getOutputContext()` properly
2.10.4 (not yet released)
#202: Parsing a protobuf message doesn't properly skip unknown fields
(reported by dmitry-timin@github)

2.10.3 (03-Mar-2020)

No changes since 2.10.2
Expand Down

0 comments on commit 4c1db5e

Please sign in to comment.