File tree 2 files changed +26
-1
lines changed
main/java/com/fasterxml/jackson/databind
test/java/com/fasterxml/jackson/databind/cfg
2 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -134,7 +134,10 @@ public abstract class DatabindContext
134
134
* type (usually {@link java.lang.Class})
135
135
*/
136
136
public JavaType constructType (Type type ) {
137
- return getTypeFactory ().constructType (type );
137
+ if (type == null ) {
138
+ return null ;
139
+ }
140
+ return getTypeFactory ().constructType (type );
138
141
}
139
142
140
143
/**
Original file line number Diff line number Diff line change
1
+ package com .fasterxml .jackson .databind .cfg ;
2
+
3
+ import com .fasterxml .jackson .databind .*;
4
+
5
+ public class DatabindContextTest extends BaseMapTest
6
+ {
7
+ private final ObjectMapper MAPPER = objectMapper ();
8
+
9
+ public void testDeserializationContext () throws Exception
10
+ {
11
+ DeserializationContext ctxt = MAPPER .getDeserializationContext ();
12
+ // should be ok to try to resolve `null`
13
+ assertNull (ctxt .constructType ((Class <?>) null ));
14
+ assertNull (ctxt .constructType ((java .lang .reflect .Type ) null ));
15
+ }
16
+
17
+ public void testSerializationContext () throws Exception
18
+ {
19
+ SerializerProvider ctxt = MAPPER .getSerializerProvider ();
20
+ assertNull (ctxt .constructType (null ));
21
+ }
22
+ }
You can’t perform that action at this time.
0 commit comments