diff --git a/README.md b/README.md index b0b0be30b5..7eadec6b12 100644 --- a/README.md +++ b/README.md @@ -410,6 +410,20 @@ One additional limitation exists for so-called core components (streaming api, j This means that anything that has to rely on additional APIs or libraries needs to be built as an extension, usually a Jackson module. + +## Branches + +`master` branch is for developing the next major Jackson version -- 3.0 -- but there +are active maintenance branches in which much of development happens: + +* `2.10` is for developing the next (and possibly last) minor 2.x version +* `2.8` and `2.9` are for backported fixes for 2.8/2.9 patch versions + +Older branches are usually not maintained after being declared as closed +on [Jackson Releases](https://github.com/FasterXML/jackson/wiki/Jackson-Releases) page, +but exist just in case a rare emergency patch is needed. +All released versions have matching git tags (`jackson-dataformats-binary-2.9.4`). + ----- ## Differences from Jackson 1.x diff --git a/release-notes/CREDITS-2.x b/release-notes/CREDITS-2.x index b0fe835bea..eb075c768c 100644 --- a/release-notes/CREDITS-2.x +++ b/release-notes/CREDITS-2.x @@ -858,10 +858,14 @@ Cyril Martin (mcoolive@github.com) does not provide "Type(Type(null))" (2.9.9) -Daniil Barvitsky (dbarvitsky@github( +Daniil Barvitsky (dbarvitsky@github) * Reported #2324: `StringCollectionDeserializer` fails with custom collection (2.9.9) +Edgar Asatryan (nstdio@github) + * Reported #2374: `ObjectMapper. getRegisteredModuleIds()` throws NPE if no modules registered + (2.9.10) + Christoph Breitkopf (bokesan@github) * Reported #2217: Suboptimal memory allocation in `TextNode.getBinaryValue()` (2.10.0) diff --git a/release-notes/VERSION-2.x b/release-notes/VERSION-2.x index 326bf900d8..c1c073cd70 100644 --- a/release-notes/VERSION-2.x +++ b/release-notes/VERSION-2.x @@ -57,6 +57,8 @@ Project: jackson-databind #2326: Block one more gadget type (CVE-2019-12384) #2341: Block one more gadget type (CVE-2019-12814) +#2374: `ObjectMapper. getRegisteredModuleIds()` throws NPE if no modules registered + (reported by Edgar A) 2.9.9 (16-May-2019) diff --git a/src/main/java/com/fasterxml/jackson/databind/ObjectMapper.java b/src/main/java/com/fasterxml/jackson/databind/ObjectMapper.java index 7c5bdae588..ab324592ef 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ObjectMapper.java +++ b/src/main/java/com/fasterxml/jackson/databind/ObjectMapper.java @@ -540,7 +540,7 @@ public boolean isEnabled(SerializationFeature f) { public Collection getRegisteredModules() { return _savedBuilderState.modules(); } - + /* /********************************************************************** /* Public API: constructing Parsers that are properly linked diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/std/ThrowableDeserializer.java b/src/main/java/com/fasterxml/jackson/databind/deser/std/ThrowableDeserializer.java index f51f2b9b2d..6b52ee2bfb 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/std/ThrowableDeserializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/std/ThrowableDeserializer.java @@ -88,7 +88,7 @@ public Object deserializeFromObject(JsonParser p, DeserializationContext ctxt) t // and finally, verify we do have single-String arg constructor (if no @JsonCreator) if (!hasStringCreator && !hasDefaultCtor) { return ctxt.handleMissingInstantiator(handledType(), getValueInstantiator(), p, - "Throwable needs a default contructor, a single-String-arg constructor; or explicit @JsonCreator"); + "Throwable needs a default constructor, a single-String-arg constructor; or explicit @JsonCreator"); } Object throwable = null; diff --git a/src/main/java/com/fasterxml/jackson/databind/introspect/AnnotatedCreatorCollector.java b/src/main/java/com/fasterxml/jackson/databind/introspect/AnnotatedCreatorCollector.java index 0ec6d662a8..681cdca277 100644 --- a/src/main/java/com/fasterxml/jackson/databind/introspect/AnnotatedCreatorCollector.java +++ b/src/main/java/com/fasterxml/jackson/databind/introspect/AnnotatedCreatorCollector.java @@ -242,8 +242,8 @@ protected AnnotatedConstructor constructDefaultConstructor(ClassUtil.Ctor ctor, } return new AnnotatedConstructor(_typeContext, ctor.getConstructor(), collectAnnotations(ctor, mixin), - collectAnnotations(ctor.getConstructor().getParameterAnnotations(), - (mixin == null) ? null : mixin.getConstructor().getParameterAnnotations())); + // 16-Jun-2019, tatu: default is zero-args, so can't have parameter annotations + NO_ANNOTATION_MAPS); } protected AnnotatedConstructor constructNonDefaultConstructor(ClassUtil.Ctor ctor, diff --git a/src/main/java/com/fasterxml/jackson/databind/type/TypeFactory.java b/src/main/java/com/fasterxml/jackson/databind/type/TypeFactory.java index c8e65578cd..8ec35e29b4 100644 --- a/src/main/java/com/fasterxml/jackson/databind/type/TypeFactory.java +++ b/src/main/java/com/fasterxml/jackson/databind/type/TypeFactory.java @@ -7,6 +7,7 @@ import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.util.Snapshottable; import com.fasterxml.jackson.databind.JavaType; +import com.fasterxml.jackson.databind.JsonNode; import com.fasterxml.jackson.databind.util.ArrayBuilders; import com.fasterxml.jackson.databind.util.ClassUtil; import com.fasterxml.jackson.databind.util.SimpleLookupCache; @@ -65,6 +66,7 @@ public final class TypeFactory private final static Class CLS_COMPARABLE = Comparable.class; private final static Class CLS_CLASS = Class.class; private final static Class CLS_ENUM = Enum.class; + private final static Class CLS_JSON_NODE = JsonNode.class; // since 2.10 private final static Class CLS_BOOL = Boolean.TYPE; private final static Class CLS_INT = Integer.TYPE; @@ -106,6 +108,14 @@ public final class TypeFactory */ protected final static SimpleType CORE_TYPE_CLASS = new SimpleType(CLS_CLASS); + /** + * Cache {@link JsonNode} because it is no critical path of simple tree model + * reading and does not have things to override + * + * @since 2.10 + */ + protected final static SimpleType CORE_TYPE_JSON_NODE = new SimpleType(CLS_JSON_NODE); + /** * Since type resolution can be expensive (specifically when resolving * actual generic types), we will use small cache to avoid repetitive @@ -1120,6 +1130,7 @@ protected JavaType _findWellKnownSimple(Class clz) { } else { if (clz == CLS_STRING) return CORE_TYPE_STRING; if (clz == CLS_OBJECT) return CORE_TYPE_OBJECT; // since 2.7 + if (clz == CLS_JSON_NODE) return CORE_TYPE_JSON_NODE; // since 2.10 } return null; } diff --git a/src/test/java/com/fasterxml/jackson/databind/module/SimpleModuleTest.java b/src/test/java/com/fasterxml/jackson/databind/module/SimpleModuleTest.java index 8595a8483b..b017fd3497 100644 --- a/src/test/java/com/fasterxml/jackson/databind/module/SimpleModuleTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/module/SimpleModuleTest.java @@ -310,6 +310,10 @@ public void testGetRegisteredModules() // Should retain ordering even if not mandated assertEquals("test1", mods.get(0).getModuleName()); assertEquals("test2", mods.get(1).getModuleName()); + + // 01-Jul-2019, [databind#2374]: verify empty list is fine + mapper = newJsonMapper(); + assertEquals(0, mapper.getRegisteredModules().size()); } /*