Avoid ClassCastException on IllegalArgumentException from sync invocation
Closes gh-25110
This commit is contained in:
committed by
Juergen Hoeller
parent
f4d33a6dfe
commit
ffe08aeca0
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2002-2019 the original author or authors.
|
* Copyright 2002-2020 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.
|
||||||
@@ -51,6 +51,7 @@ import org.springframework.util.CollectionUtils;
|
|||||||
import org.springframework.util.LinkedMultiValueMap;
|
import org.springframework.util.LinkedMultiValueMap;
|
||||||
import org.springframework.util.MultiValueMap;
|
import org.springframework.util.MultiValueMap;
|
||||||
import org.springframework.util.ObjectUtils;
|
import org.springframework.util.ObjectUtils;
|
||||||
|
import org.springframework.util.ReflectionUtils;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -352,9 +353,9 @@ public abstract class CacheAspectSupport extends AbstractCacheInvoker
|
|||||||
return wrapCacheValue(method, cache.get(key, () -> unwrapReturnValue(invokeOperation(invoker))));
|
return wrapCacheValue(method, cache.get(key, () -> unwrapReturnValue(invokeOperation(invoker))));
|
||||||
}
|
}
|
||||||
catch (Cache.ValueRetrievalException ex) {
|
catch (Cache.ValueRetrievalException ex) {
|
||||||
// The invoker wraps any Throwable in a ThrowableWrapper instance so we
|
// Directly propagate ThrowableWrapper from the invoker,
|
||||||
// can just make sure that one bubbles up the stack.
|
// or potentially also an IllegalArgumentException etc.
|
||||||
throw (CacheOperationInvoker.ThrowableWrapper) ex.getCause();
|
ReflectionUtils.rethrowRuntimeException(ex.getCause());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
Reference in New Issue
Block a user