Skip to content

Commit

Permalink
Merge branch '2.10'
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Jul 2, 2019
2 parents a6667bc + 1fae2f1 commit 02a7ef5
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 5 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 5 additions & 1 deletion release-notes/CREDITS-2.x
Original file line number Diff line number Diff line change
Expand Up @@ -858,10 +858,14 @@ Cyril Martin ([email protected])
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)
Expand Down
2 changes: 2 additions & 0 deletions release-notes/VERSION-2.x
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,7 @@ public boolean isEnabled(SerializationFeature f) {
public Collection<com.fasterxml.jackson.databind.Module> getRegisteredModules() {
return _savedBuilderState.modules();
}

/*
/**********************************************************************
/* Public API: constructing Parsers that are properly linked
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
11 changes: 11 additions & 0 deletions src/main/java/com/fasterxml/jackson/databind/type/TypeFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}

/*
Expand Down

0 comments on commit 02a7ef5

Please sign in to comment.