Skip to content

Commit 8928f0c

Browse files
committed
more testing
1 parent 6844037 commit 8928f0c

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

src/main/java/com/fasterxml/jackson/databind/DatabindContext.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,10 @@ public abstract class DatabindContext
134134
* type (usually {@link java.lang.Class})
135135
*/
136136
public JavaType constructType(Type type) {
137-
return getTypeFactory().constructType(type);
137+
if (type == null) {
138+
return null;
139+
}
140+
return getTypeFactory().constructType(type);
138141
}
139142

140143
/**
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
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+
}

0 commit comments

Comments
 (0)