Skip to content

Commit

Permalink
Avoid ClassCastException on IllegalArgumentException from sync invoca…
Browse files Browse the repository at this point in the history
…tion

Closes gh-25223
  • Loading branch information
jhoeller committed Jun 10, 2020
1 parent 700fede commit 9c73023
Showing 1 changed file with 5 additions and 4 deletions.
@@ -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");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -50,6 +50,7 @@
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.util.ObjectUtils;
import org.springframework.util.ReflectionUtils;
import org.springframework.util.StringUtils;

/**
Expand Down Expand Up @@ -365,9 +366,9 @@ public Object call() throws Exception {
}));
}
catch (Cache.ValueRetrievalException ex) {
// The invoker wraps any Throwable in a ThrowableWrapper instance so we
// can just make sure that one bubbles up the stack.
throw (CacheOperationInvoker.ThrowableWrapper) ex.getCause();
// Directly propagate ThrowableWrapper from the invoker,
// or potentially also an IllegalArgumentException etc.
ReflectionUtils.rethrowRuntimeException(ex.getCause());
}
}
else {
Expand Down

0 comments on commit 9c73023

Please sign in to comment.