Fix #2599
diff --git a/release-notes/CREDITS-2.x b/release-notes/CREDITS-2.x
index dd43216..0210234 100644
--- a/release-notes/CREDITS-2.x
+++ b/release-notes/CREDITS-2.x
@@ -1022,3 +1022,8 @@
* Reported #2566: `MissingNode.toString()` returns `null` (4 character token) instead
of empty string
(2.10.2)
+
+Tobias Preuss (johnjohndoe@github)
+ * Reported #2599: NoClassDefFoundError at DeserializationContext.<init> on Android 4.1.2
+ and Jackson 2.10.0
+ (2.10.3)
diff --git a/release-notes/VERSION-2.x b/release-notes/VERSION-2.x
index 0d92c77..2de61f8 100644
--- a/release-notes/VERSION-2.x
+++ b/release-notes/VERSION-2.x
@@ -4,6 +4,11 @@
=== Releases ===
------------------------------------------------------------------------
+2.10.3 (not yet released)
+
+#2599: NoClassDefFoundError at DeserializationContext.<init> on Android 4.1.2 and Jackson 2.10.0
+ (reported by Tobias P)
+
2.10.2 (05-Jan-2020)
#2101: `FAIL_ON_NULL_FOR_PRIMITIVES` failure does not indicate field name in exception message
diff --git a/src/main/java/com/fasterxml/jackson/databind/DeserializationContext.java b/src/main/java/com/fasterxml/jackson/databind/DeserializationContext.java
index eec32d7..8931a96 100644
--- a/src/main/java/com/fasterxml/jackson/databind/DeserializationContext.java
+++ b/src/main/java/com/fasterxml/jackson/databind/DeserializationContext.java
@@ -155,7 +155,10 @@
protected DeserializationContext(DeserializerFactory df,
DeserializerCache cache)
{
- _factory = Objects.requireNonNull(df, "Cannot pass null DeserializerFactory");
+ if (df == null) {
+ throw new NullPointerException("Cannot pass null DeserializerFactory");
+ }
+ _factory = df;
if (cache == null) {
cache = new DeserializerCache();
}
diff --git a/src/main/java/com/fasterxml/jackson/databind/ObjectMapper.java b/src/main/java/com/fasterxml/jackson/databind/ObjectMapper.java
index f54efa8..be5b8ee 100644
--- a/src/main/java/com/fasterxml/jackson/databind/ObjectMapper.java
+++ b/src/main/java/com/fasterxml/jackson/databind/ObjectMapper.java
@@ -245,8 +245,17 @@
* @since 2.10
*/
public DefaultTypeResolverBuilder(DefaultTyping t, PolymorphicTypeValidator ptv) {
- _appliesFor = Objects.requireNonNull(t, "Can not pass `null` DefaultTyping");
- _subtypeValidator = Objects.requireNonNull(ptv, "Can not pass `null` PolymorphicTypeValidator");
+ _appliesFor = _requireNonNull(t, "Can not pass `null` DefaultTyping");
+ _subtypeValidator = _requireNonNull(ptv, "Can not pass `null` PolymorphicTypeValidator");
+ }
+
+ // 20-Jan-2020: as per [databind#2599] Objects.requireNonNull() from JDK7 not in all Android so
+ private static <T> T _requireNonNull(T value, String msg) {
+ // Replacement for: return Objects.requireNonNull(t, msg);
+ if (value == null) {
+ throw new NullPointerException(msg);
+ }
+ return value;
}
/**