mirror of
https://github.com/spring-projects/spring-framework
synced 2026-06-08 17:33:33 +00:00
Merge branch '7.0.x'
This commit is contained in:
Vendored
+1
-1
@@ -84,7 +84,7 @@ public abstract class AbstractValueAdaptingCache implements Cache {
|
||||
* @return the value to return to the user
|
||||
*/
|
||||
protected @Nullable Object fromStoreValue(@Nullable Object storeValue) {
|
||||
if (this.allowNullValues && storeValue == NullValue.INSTANCE) {
|
||||
if (this.allowNullValues && storeValue instanceof NullValue) {
|
||||
return null;
|
||||
}
|
||||
return storeValue;
|
||||
|
||||
+8
@@ -24,7 +24,9 @@ import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.cache.Cache;
|
||||
import org.springframework.cache.support.NullValue;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@@ -72,6 +74,12 @@ public abstract class AbstractCacheTests<T extends Cache> {
|
||||
assertThat(cache.get(key).get()).isNull();
|
||||
assertThat(cache.get(key, String.class)).isNull();
|
||||
assertThat(cache.get(key, Object.class)).isNull();
|
||||
|
||||
cache.put(key, BeanUtils.instantiateClass(NullValue.class));
|
||||
assertThat(cache.get(key)).isNotNull();
|
||||
assertThat(cache.get(key).get()).isNull();
|
||||
assertThat(cache.get(key, String.class)).isNull();
|
||||
assertThat(cache.get(key, Object.class)).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+3
-4
@@ -36,10 +36,9 @@ public abstract class AbstractValueAdaptingCacheTests<T extends AbstractValueAda
|
||||
protected void cachePutNullValueAllowNullFalse() {
|
||||
T cache = getCache(false);
|
||||
String key = createRandomKey();
|
||||
assertThatIllegalArgumentException().isThrownBy(() ->
|
||||
cache.put(key, null))
|
||||
.withMessageContaining(CACHE_NAME_NO_NULL)
|
||||
.withMessageContaining("is configured to not allow null values but null was provided");
|
||||
assertThatIllegalArgumentException().isThrownBy(() -> cache.put(key, null))
|
||||
.withMessageContaining(CACHE_NAME_NO_NULL)
|
||||
.withMessageContaining("is configured to not allow null values but null was provided");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -854,7 +854,6 @@ public class AntPathMatcher implements PathMatcher {
|
||||
*/
|
||||
private static class PatternInfo {
|
||||
|
||||
|
||||
private final @Nullable String pattern;
|
||||
|
||||
private int uriVars;
|
||||
|
||||
Reference in New Issue
Block a user