jackson-databind: `NullPointerException` from `ResolvedRecursiveType` (regression due to fix for #2331)
Hello,
the backport for #2331 into 2.9.9, specific 2.9.9.2, which comes through 2.9.9.20190727, leads to a null pointer exception together with the JDK 8 module:
Given
package ac.simons;
import java.io.IOException;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.Test;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jdk8.Jdk8Module;
public class JacksonTest {
@Test
void shouldWorkWithoutJdk8Module() throws IOException {
ObjectMapper objectMapper = new ObjectMapper();
final JsonNode responseNode = objectMapper.readTree("{}");
Assertions.assertNotNull(responseNode);
}
@Test
void shouldWorkWithJdk8Module() throws IOException {
ObjectMapper objectMapper = new ObjectMapper()
.registerModule(new Jdk8Module());
final JsonNode responseNode = objectMapper.readTree("{}");
Assertions.assertNotNull(responseNode);
}
}
It doesn’t matter whether the object to be parsed is empty as above or contains data as for example
final JsonNode responseNode = objectMapper.readTree("{\"something\":\"foobar\"}");
Works with com.fasterxml.jackson:jackson-bom:2.9.9
and breaks with com.fasterxml.jackson:jackson-bom:2.9.9.20190727
:
java.lang.NullPointerException
at com.fasterxml.jackson.databind.type.ResolvedRecursiveType.getBindings(ResolvedRecursiveType.java:42)
at com.fasterxml.jackson.databind.type.TypeFactory._fromAny(TypeFactory.java:1243)
at com.fasterxml.jackson.databind.type.TypeFactory._fromParamType(TypeFactory.java:1452)
at com.fasterxml.jackson.databind.type.TypeFactory._fromAny(TypeFactory.java:1221)
at com.fasterxml.jackson.databind.type.TypeFactory._resolveSuperInterfaces(TypeFactory.java:1367)
at com.fasterxml.jackson.databind.type.TypeFactory._fromClass(TypeFactory.java:1314)
at com.fasterxml.jackson.databind.type.TypeFactory._fromAny(TypeFactory.java:1217)
at com.fasterxml.jackson.databind.type.TypeFactory.constructType(TypeFactory.java:631)
at com.fasterxml.jackson.databind.cfg.MapperConfig.constructType(MapperConfig.java:281)
at com.fasterxml.jackson.databind.cfg.MapperConfig.introspectClassAnnotations(MapperConfig.java:311)
at com.fasterxml.jackson.databind.deser.BasicDeserializerFactory.findTypeDeserializer(BasicDeserializerFactory.java:1571)
at com.fasterxml.jackson.databind.DeserializationContext.findRootValueDeserializer(DeserializationContext.java:483)
at com.fasterxml.jackson.databind.ObjectMapper._findRootDeserializer(ObjectMapper.java:4191)
at com.fasterxml.jackson.databind.ObjectMapper._readTreeAndClose(ObjectMapper.java:4052)
at com.fasterxml.jackson.databind.ObjectMapper.readTree(ObjectMapper.java:2552)
at ac.simons.JacksonTest.shouldWorkWithJdk8Module(JacksonTest.java:27)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:675)
at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:125)
at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:132)
at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:124)
at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:74)
at org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(ExecutableInvoker.java:115)
at org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:104)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:62)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:43)
at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:35)
at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104)
at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:98)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$6(TestMethodTestDescriptor.java:202)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:198)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:135)
at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:69)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:135)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
at java.util.ArrayList.forEach(ArrayList.java:1257)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
at java.util.ArrayList.forEach(ArrayList.java:1257)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:229)
at org.junit.platform.launcher.core.DefaultLauncher.lambda$execute$6(DefaultLauncher.java:197)
at org.junit.platform.launcher.core.DefaultLauncher.withInterceptedStreams(DefaultLauncher.java:211)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:191)
at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:128)
at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:69)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
Please find a sample project attached.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 3
- Comments: 24 (9 by maintainers)
Commits related to this issue
- Bacport #2331 in 2.9 (for 2.9.10) — committed to FasterXML/jackson-databind by cowtowncoder 5 years ago
- trying to reproduce #2395 — committed to FasterXML/jackson-databind by cowtowncoder 5 years ago
- Fixed #2395 — committed to FasterXML/jackson-databind by cowtowncoder 5 years ago
- fix jackson-databind to 2.9.9.2 CVE-2019-14379 https://github.com/FasterXML/jackson-databind/issues/2387 https://issues.apache.org/jira/browse/BEAM-7880 https://github.com/FasterXML/jackson-datab... — committed to based2/checker-maven-plugin by based2 5 years ago
- Update Jackson to 2.9.9.3 (#722) __Motivation__ A regression has been introduced in 2.9.9.2 and fixed in 2.9.9.3 See: https://github.com/FasterXML/jackson-databind/issues/2395 — committed to apple/servicetalk by ddossot 5 years ago
- Fix NPE FasterXML/jackson-databind#2395 — committed to hmcts/send-letter-service by doncem 5 years ago
- Bumped Jackson databind version to resolve CVE-2019-14379 (#511) * Bumped Jackson databank version to resolve CVE-2019-14379 * Fix NPE FasterXML/jackson-databind#2395 — committed to hmcts/send-letter-service by nitinprabhu 5 years ago
- Fix NPE FasterXML/jackson-databind#2395 — committed to hmcts/bulk-scan-processor by nitinprabhu 5 years ago
- Bumped Jackson databind version to resolve CVE-2019-14379 (#745) * Bumped Jackson databind version to resolve CVE-2019-14379 * Fix NPE FasterXML/jackson-databind#2395 — committed to hmcts/bulk-scan-processor by nitinprabhu 5 years ago
- MINOR: upgrade jackson-databind to 2.9.9.3 Some downstream components are hitting the following regression in 2.9.9.2 https://github.com/FasterXML/jackson-databind/issues/2395 — committed to xvrl/common by xvrl 5 years ago
- MINOR: upgrade jackson-databind to 2.9.9.3 Some downstream components are hitting the following regression in 2.9.9.2 https://github.com/FasterXML/jackson-databind/issues/2395 — committed to confluentinc/common by xvrl 5 years ago
- Updated jackson-databind version to 2.9.9.3 Updated `jackson-databind` version to `2.9.9.3` which contains fix for [this regression](https://github.com/FasterXML/jackson-databind/issues/2395). — committed to mibo/spring-cloud-connectors by mibo 5 years ago
- Updated jackson-databind version to 2.9.9.3 Updated `jackson-databind` version to `2.9.9.3` which contains fix for [this regression](https://github.com/FasterXML/jackson-databind/issues/2395). — committed to spring-cloud/spring-cloud-connectors by mibo 5 years ago
- Update jackson-bom to 2.9.9.20190807 to fix a regression Update to the latest [micro-patch](https://github.com/FasterXML/jackson/wiki/Jackson-Release-2.9#micro-patches) of jackson-databind 2.9.9.3 to... — committed to Dufgui/quarkus by jorsol 5 years ago
Any plans to release 2.9.9.3 soon?
2.9.9.3
ofjackson-databind
out with matchingjackson-bom
, as per:https://github.com/FasterXML/jackson/wiki/Jackson-Release-2.9
Great response time! 🚀
We are also affected.
Thanks for the quick turnaround @cowtowncoder
Indeed. Shit happens, and this is has been dealt with. Thank you, @cowtowncoder !
2.9.9.20190807
on its way now.