Skip to content

Commit 68b1f71

Browse files
committed
Fixed #2395
1 parent ffcdaad commit 68b1f71

File tree

4 files changed

+24
-1
lines changed

4 files changed

+24
-1
lines changed

release-notes/CREDITS-2.x

+5
Original file line numberDiff line numberDiff line change
@@ -850,3 +850,8 @@ Daniil Barvitsky (dbarvitsky@github)
850850
Edgar Asatryan (nstdio@github)
851851
* Reported #2374: `ObjectMapper. getRegisteredModuleIds()` throws NPE if no modules registered
852852
(2.9.9.1)
853+
854+
Michael Simons (michael-simons@github)
855+
* Reported #2395: `NullPointerException` from `ResolvedRecursiveType` (regression due to
856+
fix for #2331)
857+
(2.9.9.3)

release-notes/VERSION-2.x

+5
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ Project: jackson-databind
44
=== Releases ===
55
------------------------------------------------------------------------
66

7+
2.9.9.3 (not yet released)
8+
9+
#2395: `NullPointerException` from `ResolvedRecursiveType` (regression due to fix for #2331)
10+
(reported by Michael S)
11+
712
2.9.9.2 (27-Jul-2019)
813

914
#2331: `JsonMappingException` through nested getter with generic wildcard return type

src/main/java/com/fasterxml/jackson/databind/type/ResolvedRecursiveType.java

+10-1
Original file line numberDiff line numberDiff line change
@@ -39,16 +39,25 @@ public JavaType getSuperClass() {
3939
// 23-Jul-2019, tatu: [databind#2331] Need to also delegate this...
4040
@Override
4141
public TypeBindings getBindings() {
42-
return _referencedType.getBindings();
42+
if (_referencedType != null) { // `null` before resolution [databind#2395]
43+
return _referencedType.getBindings();
44+
}
45+
return super.getBindings();
4346
}
4447

4548
@Override
4649
public StringBuilder getGenericSignature(StringBuilder sb) {
50+
if (_referencedType != null) {
51+
return _referencedType.getGenericSignature(sb);
52+
}
4753
return _referencedType.getGenericSignature(sb);
4854
}
4955

5056
@Override
5157
public StringBuilder getErasedSignature(StringBuilder sb) {
58+
if (_referencedType != null) {
59+
return _referencedType.getErasedSignature(sb);
60+
}
5261
return _referencedType.getErasedSignature(sb);
5362
}
5463

src/main/java/com/fasterxml/jackson/databind/type/TypeFactory.java

+4
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,11 @@ public TypeFactory withModifier(TypeModifier mod)
182182
typeCache = null;
183183
} else if (_modifiers == null) {
184184
mods = new TypeModifier[] { mod };
185+
// 29-Jul-2019, tatu: Actually I think we better clear cache in this case
186+
// as well to ensure no leakage occurs (see [databind#2395])
187+
typeCache = null;
185188
} else {
189+
// but may keep existing cache otherwise
186190
mods = ArrayBuilders.insertInListNoDup(_modifiers, mod);
187191
}
188192
return new TypeFactory(typeCache, _parser, mods, _classLoader);

0 commit comments

Comments
 (0)