Skip to content

Commit 9f70373

Browse files
committed
Minor improvements for #2707 fix
1 parent c527259 commit 9f70373

1 file changed

Lines changed: 5 additions & 12 deletions

File tree

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

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1227,20 +1227,13 @@ public Object handleUnexpectedToken(JavaType targetType, JsonToken t,
12271227
h = h.next();
12281228
}
12291229
if (msg == null) {
1230+
final String targetDesc = ClassUtil.getTypeDescription(targetType);
12301231
if (t == null) {
1231-
msg = String.format("Unexpected end-of-input when binding data into %s",
1232-
ClassUtil.getTypeDescription(targetType));
1232+
msg = String.format("Unexpected end-of-input when trying read value of type %s",
1233+
targetDesc);
12331234
} else {
1234-
final String targetDesc = ClassUtil.getTypeDescription(targetType);
1235-
final String valueDesc = _shapeForToken(t);
1236-
if (valueDesc == null) { // no specific description
1237-
msg = String.format("Cannot deserialize instance of %s out of %s token",
1238-
targetDesc, t);
1239-
} else {
1240-
msg = String.format(
1241-
"Cannot deserialize instance of %s from %s (token `JsonToken.%s`)",
1242-
targetDesc, valueDesc, t);
1243-
}
1235+
msg = String.format("Cannot deserialize value of type %s from %s (token `JsonToken.%s`)",
1236+
targetDesc, _shapeForToken(t), t);
12441237
}
12451238
}
12461239
reportInputMismatch(targetType, msg);

0 commit comments

Comments
 (0)