Skip to content

Commit 7bc0fc4

Browse files
committed
Backport #1260 fix in 2.7
1 parent 866ca4a commit 7bc0fc4

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

release-notes/CREDITS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -459,3 +459,7 @@ Nick Babcock (nickbabcock)
459459
Andrew Joseph (apjoseph@github)
460460
* Reported #1248: `Annotated` returns raw type in place of Generic Type in 2.7.x
461461
(2.7.5)
462+
463+
Erich Schubert (kno10@github)
464+
* Reported #1260: `NullPointerException` in `JsonNodeDeserializer`, provided fix
465+
(2.7.5)

release-notes/VERSION

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ Project: jackson-databind
2121
#1248: `Annotated` returns raw type in place of Generic Type in 2.7.x
2222
(reported by Andrew J, apjoseph@github)
2323
#1253: Problem with context handling for `TokenBuffer`, field name
24+
#1260: `NullPointerException` in `JsonNodeDeserializer`
25+
(reported by Eric S)
2426

2527
2.7.4 (29-Apr-2016)
2628

src/main/java/com/fasterxml/jackson/databind/DeserializationContext.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -968,9 +968,10 @@ public JsonMappingException mappingException(Class<?> targetClass) {
968968
}
969969

970970
public JsonMappingException mappingException(Class<?> targetClass, JsonToken token) {
971+
String tokenDesc = (token == null) ? "<end of input>" : String.format("%s token", token);
971972
return JsonMappingException.from(_parser,
972-
String.format("Can not deserialize instance of %s out of %s token",
973-
_calcName(targetClass), token));
973+
String.format("Can not deserialize instance of %s out of %s",
974+
_calcName(targetClass), tokenDesc));
974975
}
975976

976977
/**

src/main/java/com/fasterxml/jackson/databind/deser/std/JsonNodeDeserializer.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,9 @@ protected final ObjectNode deserializeObject(JsonParser p, DeserializationContex
219219
for (; key != null; key = p.nextFieldName()) {
220220
JsonNode value;
221221
JsonToken t = p.nextToken();
222+
if (t == null) {
223+
throw ctxt.mappingException("Unexpected end-of-input when binding data into ObjectNode");
224+
}
222225
switch (t.id()) {
223226
case JsonTokenId.ID_START_OBJECT:
224227
value = deserializeObject(p, ctxt, nodeFactory);

0 commit comments

Comments
 (0)