Skip to content

Commit 4eb4f79

Browse files
committed
Fix #2599
1 parent 179bb15 commit 4eb4f79

File tree

4 files changed

+25
-3
lines changed

4 files changed

+25
-3
lines changed

release-notes/CREDITS-2.x

+5
Original file line numberDiff line numberDiff line change
@@ -1022,3 +1022,8 @@ Greg Arakelian (arakelian@github)
10221022
* Reported #2566: `MissingNode.toString()` returns `null` (4 character token) instead
10231023
of empty string
10241024
(2.10.2)
1025+
1026+
Tobias Preuss (johnjohndoe@github)
1027+
* Reported #2599: NoClassDefFoundError at DeserializationContext.<init> on Android 4.1.2
1028+
and Jackson 2.10.0
1029+
(2.10.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.10.3 (not yet released)
8+
9+
#2599: NoClassDefFoundError at DeserializationContext.<init> on Android 4.1.2 and Jackson 2.10.0
10+
(reported by Tobias P)
11+
712
2.10.2 (05-Jan-2020)
813

914
#2101: `FAIL_ON_NULL_FOR_PRIMITIVES` failure does not indicate field name in exception message

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

+4-1
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,10 @@ protected DeserializationContext(DeserializerFactory df) {
155155
protected DeserializationContext(DeserializerFactory df,
156156
DeserializerCache cache)
157157
{
158-
_factory = Objects.requireNonNull(df, "Cannot pass null DeserializerFactory");
158+
if (df == null) {
159+
throw new NullPointerException("Cannot pass null DeserializerFactory");
160+
}
161+
_factory = df;
159162
if (cache == null) {
160163
cache = new DeserializerCache();
161164
}

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

+11-2
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,17 @@ public DefaultTypeResolverBuilder(DefaultTyping t) {
245245
* @since 2.10
246246
*/
247247
public DefaultTypeResolverBuilder(DefaultTyping t, PolymorphicTypeValidator ptv) {
248-
_appliesFor = Objects.requireNonNull(t, "Can not pass `null` DefaultTyping");
249-
_subtypeValidator = Objects.requireNonNull(ptv, "Can not pass `null` PolymorphicTypeValidator");
248+
_appliesFor = _requireNonNull(t, "Can not pass `null` DefaultTyping");
249+
_subtypeValidator = _requireNonNull(ptv, "Can not pass `null` PolymorphicTypeValidator");
250+
}
251+
252+
// 20-Jan-2020: as per [databind#2599] Objects.requireNonNull() from JDK7 not in all Android so
253+
private static <T> T _requireNonNull(T value, String msg) {
254+
// Replacement for: return Objects.requireNonNull(t, msg);
255+
if (value == null) {
256+
throw new NullPointerException(msg);
257+
}
258+
return value;
250259
}
251260

252261
/**

0 commit comments

Comments
 (0)