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 @@ -492,21 +492,22 @@ protected void _releaseBuffers()
@Override
public JsonToken nextToken() throws JacksonException
{
System.out.println("nextToken(): state="+_state+", ptr="+_inputPtr);
JsonToken t = nextTokenX();
if (t == JsonToken.PROPERTY_NAME) {
System.out.print("Field name: "+currentName());
System.out.print(" Field name: "+currentName());
} else if (t == JsonToken.VALUE_NUMBER_INT) {
System.out.print("Int: "+getIntValue());
System.out.print(" Int: "+getIntValue());
} else if (t == JsonToken.VALUE_STRING) {
System.out.print("String: '"+getText()+"'");
System.out.print(" String: '"+getString()+"'");
} else {
System.out.print("Next: "+t);
System.out.print(" Next: "+t);
}
System.out.println(" (state now: "+_state+", ptr "+_inputPtr+")");
return t;
}

public JsonToken nextTokenX() throws JacksonException {
public JsonToken nextTokenX() throws JacksonException
*/

@Override
Expand Down Expand Up @@ -1041,6 +1042,7 @@ public String nextName() throws JacksonException
return name;
}
if (_state == STATE_MESSAGE_END) {
close(); // sets state to STATE_CLOSED
_updateToken(JsonToken.END_OBJECT);
return null;
}
Expand Down Expand Up @@ -1126,6 +1128,7 @@ public boolean nextName(SerializableString sstr) throws JacksonException
return name.equals(sstr.getValue());
}
if (_state == STATE_MESSAGE_END) {
close(); // sets state to STATE_CLOSED
_updateToken(JsonToken.END_OBJECT);
return false;
}
Expand Down Expand Up @@ -1215,6 +1218,7 @@ public int nextNameMatch(PropertyNameMatcher matcher) throws JacksonException
return matcher.matchName(name);
}
if (_state == STATE_MESSAGE_END) {
close(); // sets state to STATE_CLOSED
_updateToken(JsonToken.END_OBJECT);
return PropertyNameMatcher.MATCH_END_OBJECT;
}
Expand All @@ -1236,7 +1240,7 @@ private int _nextNameMatch2(PropertyNameMatcher matcher) throws JacksonException

/*
/**********************************************************************
/* Public API, traversal, optimized: nextFieldName()
/* Public API, traversal, optimized: nextName()
/**********************************************************************
*/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,14 @@ public void testSparse561() throws Exception
+ " repeated uint32 f = 1;\n"
+ "}";

Map<String, Object> input = Map.of("f", new int[] { 1, 2 });
Map<String, Object> input = Map.of("f", new int[] { 100, 200 });

ProtobufSchema schema = MAPPER.schemaLoader().load(new StringReader(SCHEMA_STR));
byte[] encoded = MAPPER.writer(schema).writeValueAsBytes(input);
JsonNode t = MAPPER.readerFor(JsonNode.class).with(schema).readValue(encoded);

assertEquals(2, t.get("f").size());
assertEquals(1, t.get("f").get(0).asInt());
assertEquals(2, t.get("f").get(1).asInt());
assertEquals(100, t.get("f").get(0).asInt());
assertEquals(200, t.get("f").get(1).asInt());
}
}