Skip to content

Commit

Permalink
Fixing build failures due to changes (which may be reverted) to JsonP…
Browse files Browse the repository at this point in the history
…arserSequence
  • Loading branch information
cowtowncoder committed Jul 3, 2016
1 parent 07cc3c6 commit dad2e3e
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 12 deletions.
Expand Up @@ -107,6 +107,9 @@ protected Object _deserialize(JsonParser p, DeserializationContext ctxt) throws
tb.writeStartObject(); // recreate START_OBJECT
tb.writeFieldName(_typePropertyName);
tb.writeString(typeId);
// 02-Jul-2016, tatu: Depending on for JsonParserSequence is initialized it may
// try to access current token; ensure there isn't one
p.clearCurrentToken();
p = JsonParserSequence.createFlattened(tb.asParser(p), p);
p.nextToken();
}
Expand Down
Expand Up @@ -118,6 +118,9 @@ protected Object _deserializeTypedForId(JsonParser p, DeserializationContext ctx
tb.writeString(typeId);
}
if (tb != null) { // need to put back skipped properties?
// 02-Jul-2016, tatu: Depending on for JsonParserSequence is initialized it may
// try to access current token; ensure there isn't one
p.clearCurrentToken();
p = JsonParserSequence.createFlattened(tb.asParser(p), p);
}
// Must point to the next value; tb had no current, jp pointed to VALUE_STRING:
Expand All @@ -128,7 +131,8 @@ protected Object _deserializeTypedForId(JsonParser p, DeserializationContext ctx

// off-lined to keep main method lean and mean...
@SuppressWarnings("resource")
protected Object _deserializeTypedUsingDefaultImpl(JsonParser p, DeserializationContext ctxt, TokenBuffer tb) throws IOException
protected Object _deserializeTypedUsingDefaultImpl(JsonParser p, DeserializationContext ctxt,
TokenBuffer tb) throws IOException
{
// As per [JACKSON-614], may have default implementation to use
JsonDeserializer<Object> deser = _findDefaultImplDeserializer(ctxt);
Expand Down
Expand Up @@ -111,6 +111,9 @@ protected Object _deserialize(JsonParser p, DeserializationContext ctxt) throws
tb.writeStartObject(); // recreate START_OBJECT
tb.writeFieldName(_typePropertyName);
tb.writeString(typeId);
// 02-Jul-2016, tatu: Depending on for JsonParserSequence is initialized it may
// try to access current token; ensure there isn't one
p.clearCurrentToken();
p = JsonParserSequence.createFlattened(tb.asParser(p), p);
p.nextToken();
}
Expand Down
22 changes: 11 additions & 11 deletions src/main/java/com/fasterxml/jackson/databind/util/TokenBuffer.java
Expand Up @@ -1032,41 +1032,41 @@ public void copyCurrentEvent(JsonParser p) throws IOException
}

@Override
public void copyCurrentStructure(JsonParser jp) throws IOException
public void copyCurrentStructure(JsonParser p) throws IOException
{
JsonToken t = jp.getCurrentToken();
JsonToken t = p.getCurrentToken();

// Let's handle field-name separately first
if (t == JsonToken.FIELD_NAME) {
if (_mayHaveNativeIds) {
_checkNativeIds(jp);
_checkNativeIds(p);
}
writeFieldName(jp.getCurrentName());
t = jp.nextToken();
writeFieldName(p.getCurrentName());
t = p.nextToken();
// fall-through to copy the associated value
}

if (_mayHaveNativeIds) {
_checkNativeIds(jp);
_checkNativeIds(p);
}

switch (t) {
case START_ARRAY:
writeStartArray();
while (jp.nextToken() != JsonToken.END_ARRAY) {
copyCurrentStructure(jp);
while (p.nextToken() != JsonToken.END_ARRAY) {
copyCurrentStructure(p);
}
writeEndArray();
break;
case START_OBJECT:
writeStartObject();
while (jp.nextToken() != JsonToken.END_OBJECT) {
copyCurrentStructure(jp);
while (p.nextToken() != JsonToken.END_OBJECT) {
copyCurrentStructure(p);
}
writeEndObject();
break;
default: // others are simple:
copyCurrentEvent(jp);
copyCurrentEvent(p);
}
}

Expand Down

0 comments on commit dad2e3e

Please sign in to comment.