Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullPointerException in ResolvedRecursiveType.getBindings #2408

Closed
remal opened this issue Aug 5, 2019 · 2 comments
Closed

NullPointerException in ResolvedRecursiveType.getBindings #2408

remal opened this issue Aug 5, 2019 · 2 comments
Labels
duplicate Duplicate of an existing (usually earlier) issue
Milestone

Comments

@remal
Copy link
Contributor

remal commented Aug 5, 2019

Versions:
jackson-databind: 2.9.9.2
Java: 8

I have Jackson module like this:

import com.fasterxml.jackson.core.TreeNode;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.Module;
import com.fasterxml.jackson.databind.module.SimpleModule;

public class TreeNodeTypeMappingModule extends SimpleModule {
    {
        addAbstractTypeMapping(TreeNode.class, JsonNode.class);
    }
}

When I'm trying to deserialize JSON into TreeNode, I'm getting this exception:

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.constructSpecializedType(TypeFactory.java:364)
	at com.fasterxml.jackson.databind.module.SimpleAbstractTypeResolver.findTypeMapping(SimpleAbstractTypeResolver.java:80)
	at com.fasterxml.jackson.databind.deser.BasicDeserializerFactory._mapAbstractType2(BasicDeserializerFactory.java:230)
	at com.fasterxml.jackson.databind.deser.BasicDeserializerFactory.mapAbstractType(BasicDeserializerFactory.java:205)
	at com.fasterxml.jackson.databind.deser.DeserializerCache._createDeserializer(DeserializerCache.java:322)
	at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCache2(DeserializerCache.java:264)
	at com.fasterxml.jackson.databind.deser.DeserializerCache._createAndCacheValueDeserializer(DeserializerCache.java:244)
	at com.fasterxml.jackson.databind.deser.DeserializerCache.findValueDeserializer(DeserializerCache.java:142)
	at com.fasterxml.jackson.databind.DeserializationContext.findRootValueDeserializer(DeserializationContext.java:477)
	at com.fasterxml.jackson.databind.ObjectMapper._findRootDeserializer(ObjectMapper.java:4191)
	at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4006)
	at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3043)
        at ....................
@benjamin-ross
Copy link

This issue is covered by: #2395

@cowtowncoder
Copy link
Member

First of all, thank you for reporting this. And second, yes, this looks like a dup of #2395.
Unfortunately only observable when a module is included that sets TypeModifier (and resolved a recursive type variable), which is why test suite of jackson-databind did not catch it -- and secondly, because micro-patch only built of jackson-databind, test suites of modules that would have caught it (java8), were not exercised either.

@cowtowncoder cowtowncoder added the duplicate Duplicate of an existing (usually earlier) issue label Aug 5, 2019
@cowtowncoder cowtowncoder modified the milestones: 2.9.9, 2.9.9.3 Aug 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate Duplicate of an existing (usually earlier) issue
Projects
None yet
Development

No branches or pull requests

3 participants