Skip to content

Commit

Permalink
Fix #2520
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Oct 24, 2019
1 parent 293f736 commit 2c4e270
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
5 changes: 5 additions & 0 deletions release-notes/CREDITS-2.x
Original file line number Diff line number Diff line change
Expand Up @@ -990,3 +990,8 @@ Johan Haleby (johanhaleby@github)
* Reported #2513: BigDecimalAsStringSerializer in NumberSerializer throws IllegalStateException
in 2.10
(2.10.1)
Mark Schäfer (mark--@github)
* Reported #2520: Sub-optimal exception message when failing to deserialize non-static inner classes
(2.10.1)
2 changes: 2 additions & 0 deletions release-notes/VERSION-2.x
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ Project: jackson-databind
(contributed by Marc M)
#2513: BigDecimalAsStringSerializer in NumberSerializer throws IllegalStateException in 2.10
(reported by Johan H)
#2520: Sub-optimal exception message when failing to deserialize non-static inner classes
(reported by Mark S)

2.10.0 (26-Sep-2019)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1292,7 +1292,7 @@ protected Object deserializeFromObjectUsingNonDefault(JsonParser p,
Class<?> raw = _beanType.getRawClass();
if (ClassUtil.isNonStaticInnerClass(raw)) {
return ctxt.handleMissingInstantiator(raw, null, p,
"can only instantiate non-static inner class by using default, no-argument constructor");
"non-static inner classes like this can only by instantiated using default, no-argument constructor");
}
return ctxt.handleMissingInstantiator(raw, getValueInstantiator(), p,
"cannot deserialize from Object value (no delegate- or property-based Creator)");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ public void testIssue1501() throws Exception
try {
MAPPER.readValue(ser, Something1501.class);
fail("Should not pass");
} catch (JsonMappingException e) {
} catch (MismatchedInputException e) {
verifyException(e, "Cannot construct instance");
verifyException(e, "InnerSomething1501");
verifyException(e, "can only instantiate non-static inner class by using default");
verifyException(e, "non-static inner classes like this can only by instantiated using default");
}
}

Expand All @@ -76,10 +76,10 @@ public void testIssue1502() throws Exception
try {
MAPPER.readValue(ser, Something1502.class);
fail("Should not pass");
} catch (JsonMappingException e) {
} catch (MismatchedInputException e) {
verifyException(e, "Cannot construct instance");
verifyException(e, "InnerSomething1502");
verifyException(e, "can only instantiate non-static inner class by using default");
verifyException(e, "non-static inner classes like this can only by instantiated using default");
}
}

Expand Down

0 comments on commit 2c4e270

Please sign in to comment.