Skip to content

Commit 02a7ef5

Browse files
committed
Merge branch '2.10'
2 parents a6667bc + 1fae2f1 commit 02a7ef5

File tree

8 files changed

+40
-5
lines changed

8 files changed

+40
-5
lines changed

README.md

+14
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,20 @@ One additional limitation exists for so-called core components (streaming api, j
410410
This means that anything that has to rely on additional APIs or libraries needs to be built as an extension,
411411
usually a Jackson module.
412412

413+
414+
## Branches
415+
416+
`master` branch is for developing the next major Jackson version -- 3.0 -- but there
417+
are active maintenance branches in which much of development happens:
418+
419+
* `2.10` is for developing the next (and possibly last) minor 2.x version
420+
* `2.8` and `2.9` are for backported fixes for 2.8/2.9 patch versions
421+
422+
Older branches are usually not maintained after being declared as closed
423+
on [Jackson Releases](https://github.com/FasterXML/jackson/wiki/Jackson-Releases) page,
424+
but exist just in case a rare emergency patch is needed.
425+
All released versions have matching git tags (`jackson-dataformats-binary-2.9.4`).
426+
413427
-----
414428

415429
## Differences from Jackson 1.x

release-notes/CREDITS-2.x

+5-1
Original file line numberDiff line numberDiff line change
@@ -858,10 +858,14 @@ Cyril Martin ([email protected])
858858
does not provide "Type(Type(null))"
859859
(2.9.9)
860860

861-
Daniil Barvitsky (dbarvitsky@github(
861+
Daniil Barvitsky (dbarvitsky@github)
862862
* Reported #2324: `StringCollectionDeserializer` fails with custom collection
863863
(2.9.9)
864864

865+
Edgar Asatryan (nstdio@github)
866+
* Reported #2374: `ObjectMapper. getRegisteredModuleIds()` throws NPE if no modules registered
867+
(2.9.10)
868+
865869
Christoph Breitkopf (bokesan@github)
866870
* Reported #2217: Suboptimal memory allocation in `TextNode.getBinaryValue()`
867871
(2.10.0)

release-notes/VERSION-2.x

+2
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ Project: jackson-databind
5757

5858
#2326: Block one more gadget type (CVE-2019-12384)
5959
#2341: Block one more gadget type (CVE-2019-12814)
60+
#2374: `ObjectMapper. getRegisteredModuleIds()` throws NPE if no modules registered
61+
(reported by Edgar A)
6062

6163
2.9.9 (16-May-2019)
6264

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ public boolean isEnabled(SerializationFeature f) {
540540
public Collection<com.fasterxml.jackson.databind.Module> getRegisteredModules() {
541541
return _savedBuilderState.modules();
542542
}
543-
543+
544544
/*
545545
/**********************************************************************
546546
/* Public API: constructing Parsers that are properly linked

src/main/java/com/fasterxml/jackson/databind/deser/std/ThrowableDeserializer.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public Object deserializeFromObject(JsonParser p, DeserializationContext ctxt) t
8888
// and finally, verify we do have single-String arg constructor (if no @JsonCreator)
8989
if (!hasStringCreator && !hasDefaultCtor) {
9090
return ctxt.handleMissingInstantiator(handledType(), getValueInstantiator(), p,
91-
"Throwable needs a default contructor, a single-String-arg constructor; or explicit @JsonCreator");
91+
"Throwable needs a default constructor, a single-String-arg constructor; or explicit @JsonCreator");
9292
}
9393

9494
Object throwable = null;

src/main/java/com/fasterxml/jackson/databind/introspect/AnnotatedCreatorCollector.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,8 @@ protected AnnotatedConstructor constructDefaultConstructor(ClassUtil.Ctor ctor,
242242
}
243243
return new AnnotatedConstructor(_typeContext, ctor.getConstructor(),
244244
collectAnnotations(ctor, mixin),
245-
collectAnnotations(ctor.getConstructor().getParameterAnnotations(),
246-
(mixin == null) ? null : mixin.getConstructor().getParameterAnnotations()));
245+
// 16-Jun-2019, tatu: default is zero-args, so can't have parameter annotations
246+
NO_ANNOTATION_MAPS);
247247
}
248248

249249
protected AnnotatedConstructor constructNonDefaultConstructor(ClassUtil.Ctor ctor,

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

+11
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import com.fasterxml.jackson.core.type.TypeReference;
88
import com.fasterxml.jackson.core.util.Snapshottable;
99
import com.fasterxml.jackson.databind.JavaType;
10+
import com.fasterxml.jackson.databind.JsonNode;
1011
import com.fasterxml.jackson.databind.util.ArrayBuilders;
1112
import com.fasterxml.jackson.databind.util.ClassUtil;
1213
import com.fasterxml.jackson.databind.util.SimpleLookupCache;
@@ -65,6 +66,7 @@ public final class TypeFactory
6566
private final static Class<?> CLS_COMPARABLE = Comparable.class;
6667
private final static Class<?> CLS_CLASS = Class.class;
6768
private final static Class<?> CLS_ENUM = Enum.class;
69+
private final static Class<?> CLS_JSON_NODE = JsonNode.class; // since 2.10
6870

6971
private final static Class<?> CLS_BOOL = Boolean.TYPE;
7072
private final static Class<?> CLS_INT = Integer.TYPE;
@@ -106,6 +108,14 @@ public final class TypeFactory
106108
*/
107109
protected final static SimpleType CORE_TYPE_CLASS = new SimpleType(CLS_CLASS);
108110

111+
/**
112+
* Cache {@link JsonNode} because it is no critical path of simple tree model
113+
* reading and does not have things to override
114+
*
115+
* @since 2.10
116+
*/
117+
protected final static SimpleType CORE_TYPE_JSON_NODE = new SimpleType(CLS_JSON_NODE);
118+
109119
/**
110120
* Since type resolution can be expensive (specifically when resolving
111121
* actual generic types), we will use small cache to avoid repetitive
@@ -1120,6 +1130,7 @@ protected JavaType _findWellKnownSimple(Class<?> clz) {
11201130
} else {
11211131
if (clz == CLS_STRING) return CORE_TYPE_STRING;
11221132
if (clz == CLS_OBJECT) return CORE_TYPE_OBJECT; // since 2.7
1133+
if (clz == CLS_JSON_NODE) return CORE_TYPE_JSON_NODE; // since 2.10
11231134
}
11241135
return null;
11251136
}

src/test/java/com/fasterxml/jackson/databind/module/SimpleModuleTest.java

+4
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,10 @@ public void testGetRegisteredModules()
310310
// Should retain ordering even if not mandated
311311
assertEquals("test1", mods.get(0).getModuleName());
312312
assertEquals("test2", mods.get(1).getModuleName());
313+
314+
// 01-Jul-2019, [databind#2374]: verify empty list is fine
315+
mapper = newJsonMapper();
316+
assertEquals(0, mapper.getRegisteredModules().size());
313317
}
314318

315319
/*

0 commit comments

Comments
 (0)