Skip to content

Commit

Permalink
Fix to TokenBuffer refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Aug 25, 2019
1 parent 83cee1f commit 751296a
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/main/java/com/fasterxml/jackson/databind/util/TokenBuffer.java
Original file line number Diff line number Diff line change
Expand Up @@ -1082,7 +1082,7 @@ public void copyCurrentEvent(JsonParser p) throws IOException
writeObject(p.getEmbeddedObject());
break;
default:
throw new RuntimeException("Internal error: should never end up through this code path");
throw new RuntimeException("Internal error: unexpected token: "+p.getCurrentToken());
}
}

Expand All @@ -1104,7 +1104,8 @@ public void copyCurrentStructure(JsonParser p) throws IOException
}

// We'll do minor handling here to separate structured, scalar values,
// then delegate appropriately
// then delegate appropriately.
// Plus also deal with oddity of "dangling" END_OBJECT/END_ARRAY
switch (t) {
case START_ARRAY:
if (_mayHaveNativeIds) {
Expand All @@ -1120,6 +1121,12 @@ public void copyCurrentStructure(JsonParser p) throws IOException
writeStartObject();
_copyContents(p);
break;
case END_ARRAY:
writeEndArray();
break;
case END_OBJECT:
writeEndObject();
break;
default: // others are simple:
_copyCurrentValue(p, t);
}
Expand Down Expand Up @@ -1156,16 +1163,16 @@ private final void _copyContents(JsonParser p) throws IOException
break;

case END_ARRAY:
writeEndArray();
if (--depth == 0) {
return;
}
writeEndArray();
break;
case END_OBJECT:
writeEndObject();
if (--depth == 0) {
return;
}
writeEndObject();
break;

default:
Expand Down Expand Up @@ -1229,7 +1236,7 @@ private void _copyCurrentValue(JsonParser p, JsonToken t) throws IOException
writeObject(p.getEmbeddedObject());
break;
default:
throw new RuntimeException("Internal error: should never end up through this code path");
throw new RuntimeException("Internal error: unexpected token: "+t);
}
}

Expand Down

0 comments on commit 751296a

Please sign in to comment.