Skip to content

Commit e4d183f

Browse files
committed
Merging minor piece of #4101
1 parent 322a640 commit e4d183f

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

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

+5
Original file line numberDiff line numberDiff line change
@@ -2272,9 +2272,14 @@ public ObjectMapper setConstructorDetector(ConstructorDetector cd) {
22722272
/**
22732273
* Method for specifying {@link CacheProvider} instance, to provide Cache instances to be used in components downstream.
22742274
*
2275+
* @cacheProvider Cache provider for this mapper to use
2276+
*
2277+
* @throws IllegalArgumentException if given provider is null
2278+
*
22752279
* @since 2.16
22762280
*/
22772281
public ObjectMapper setCacheProvider(CacheProvider cacheProvider) {
2282+
_assertNotNull("cacheProvider", cacheProvider);
22782283
_deserializationConfig = _deserializationConfig.with(cacheProvider);
22792284
_serializationConfig = _serializationConfig.with(cacheProvider);
22802285
return this;

src/main/java/com/fasterxml/jackson/databind/deser/DeserializerCache.java

+8-1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@ public final class DeserializerCache
2424
{
2525
private static final long serialVersionUID = 1L;
2626

27+
/**
28+
* Default size of the underlying cache to use.
29+
*
30+
* @since 2.16
31+
*/
32+
public final static int DEFAULT_MAX_CACHE_SIZE = 2000;
33+
2734
/*
2835
/**********************************************************
2936
/* Caching
@@ -52,7 +59,7 @@ public final class DeserializerCache
5259
*/
5360

5461
public DeserializerCache() {
55-
this(2000); // see [databind#1995]
62+
this(DEFAULT_MAX_CACHE_SIZE); // see [databind#1995]
5663
}
5764

5865
public DeserializerCache(int maxSize) {

0 commit comments

Comments
 (0)