Reliable null value handling in ConcurrentMapCache, GuavaCache, JCacheCache
The 4.1 variant of this fix just introduces readResolve declarations to the existing NullHolder classes. Issue: SPR-13553
This commit is contained in:
@@ -28,8 +28,8 @@ import org.springframework.cache.support.SimpleValueWrapper;
|
|||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Spring {@link Cache} adapter implementation on top of a
|
* Spring {@link org.springframework.cache.Cache} adapter implementation
|
||||||
* Guava {@link com.google.common.cache.Cache} instance.
|
* on top of a Guava {@link com.google.common.cache.Cache} instance.
|
||||||
*
|
*
|
||||||
* <p>Requires Google Guava 12.0 or higher.
|
* <p>Requires Google Guava 12.0 or higher.
|
||||||
*
|
*
|
||||||
@@ -174,6 +174,10 @@ public class GuavaCache implements Cache {
|
|||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
private static class NullHolder implements Serializable {
|
private static class NullHolder implements Serializable {
|
||||||
|
|
||||||
|
private Object readResolve() {
|
||||||
|
return NULL_HOLDER;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2014 the original author or authors.
|
* Copyright 2002-2015 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -142,6 +142,10 @@ public class JCacheCache implements Cache {
|
|||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
private static class NullHolder implements Serializable {
|
private static class NullHolder implements Serializable {
|
||||||
|
|
||||||
|
private Object readResolve() {
|
||||||
|
return NULL_HOLDER;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ import org.springframework.cache.support.SimpleValueWrapper;
|
|||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simple {@link Cache} implementation based on the core JDK
|
* Simple {@link org.springframework.cache.Cache} implementation based on the
|
||||||
* {@code java.util.concurrent} package.
|
* core JDK {@code java.util.concurrent} package.
|
||||||
*
|
*
|
||||||
* <p>Useful for testing or simple caching scenarios, typically in combination
|
* <p>Useful for testing or simple caching scenarios, typically in combination
|
||||||
* with {@link org.springframework.cache.support.SimpleCacheManager} or
|
* with {@link org.springframework.cache.support.SimpleCacheManager} or
|
||||||
@@ -172,6 +172,10 @@ public class ConcurrentMapCache implements Cache {
|
|||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
private static class NullHolder implements Serializable {
|
private static class NullHolder implements Serializable {
|
||||||
|
|
||||||
|
private Object readResolve() {
|
||||||
|
return NULL_HOLDER;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user