On Thu, Feb 22, 2018 at 6:01 AM, Ayush Gupta <ayushg...@gmail.com> wrote:
> 0down votefavorite
> I have upgraded jackson from version 2.6.1 to 2.8.7 in my project
> recently. And I'm facing the following issue:
> When I try to deserialize the data I get back using an object mapper, if I
> don't provide type arguments for constructing from canonical in version
> 2.6.1, it works fine. So for example, the following code runs fine on 2.6.1:
> returnType = "java.util.List";
> But on 2.8.7, it gives an exception. The stacktrace of the exception:
> java.rmi.RemoteException: java.lang.NullPointerException:null.
> But if I pass the string with the complete type information, even if only
> pass it as Object, ie, returnType = "java.util.List<java.lang.Object>";,
> it works fine.
> Is there a way to make this backward compatible?
Ok. This method really isn't intended for usage outside of framework (it
was added to support polymorphic (de)serialization),
but it seems reasonable to allow non-generic types too. Contract should be
that anything `JavaType.toCanonical()`
produces should be acceptable as input for
However.... in your case, input string really is NOT canonical: it is
missing type parameter definitions.
So it is invalid input, even if earlier versions accepted it.
Could you file an issue for `jackson-databind`? I can have a look and
consider what to do here; code could either
give better exception message (indicating nature of the problem), or,
possibly, produce equivalent of `List<?>`.
As a workaround I would suggest checking if there is generic type info (any
`<` in there?); if not,
just use `Class.forName()`, then construct type with that. If there is, use
Fix would go in 2.9.5 although I might backport it in 2.8 -- but there will
only be micro-patches for
2.8 and it is unclear if and when databind one would be relased.
-+ Tatu +-
> I have also posted a StackOverflow question here: https://stackoverflow.
> You received this message because you are subscribed to the Google Groups
> "jackson-user" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to jackson-user+unsubscr...@googlegroups.com.
> To post to this group, send email to firstname.lastname@example.org.
> For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups
To unsubscribe from this group and stop receiving emails from it, send an email
To post to this group, send email to email@example.com.
For more options, visit https://groups.google.com/d/optout.