-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Closed
Description
Version information - "Jackson-databind - version 2.9.1"
Having enabled the property "UNWRAP_ROOT_VALUE" for deserialization as follows:
mapper.enable(DeserializationFeature.UNWRAP_ROOT_VALUE);
a simple json message like "{"TestMessage":"This test is awesome"}" is not parsed to a JsonNode when using
eventNode = this.mapper.readTree(message)
and getting the following exception:
Caused by: java.util.MissingFormatArgumentException: Format specifier '%s'
at java.util.Formatter.format(Formatter.java:2519) ~[na:1.8.0_121]
at java.util.Formatter.format(Formatter.java:2455) ~[na:1.8.0_121]
at java.lang.String.format(String.java:2940) ~[na:1.8.0_121]
at com.fasterxml.jackson.databind.DatabindContext._format(DatabindContext.java:326) ~[jackson-databind-2.9.1.jar:2.9.1]
at com.fasterxml.jackson.databind.DeserializationContext.reportInputMismatch(DeserializationContext.java:1341) ~[jackson-databind-2.9.1.jar:2.9.1]
at com.fasterxml.jackson.databind.ObjectMapper._unwrapAndDeserialize(ObjectMapper.java:4076) ~[jackson-databind-2.9.1.jar:2.9.1]
at com.fasterxml.jackson.databind.ObjectMapper._readTreeAndClose(ObjectMapper.java:4042) ~[jackson-databind-2.9.1.jar:2.9.1]
at com.fasterxml.jackson.databind.ObjectMapper.readTree(ObjectMapper.java:2539) ~[jackson-databind-2.9.1.jar:2.9.1]
at com.airplus.sid.iomDataImport.config.TestReceiver.receive(TestReceiver.java:49) ~[test-classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_121]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_121]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_121]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_121]
Upon further debugging, it was found that in ObjectMapper class
String actualName = p.getCurrentName();
if (!expSimpleName.equals(actualName)) {
ctxt.reportInputMismatch(rootType,
"Root name '%s' does not match expected ('%s') for type %s",
actualName, expSimpleName);
}
Basically, only 2 arguments are fed when 3 are expected.
Also, its a different issue, but why is it expecting the rootname to be "JSONNode" when it should get it from the Json itself?
Metadata
Metadata
Assignees
Labels
No labels