Skip to content

Commit

Permalink
Don't cast cached Throwable to Exception as it's too narrow. (#1139)
Browse files Browse the repository at this point in the history
Reasoning:
JCache spec and Payara implementation allows caching of exceptions.
In theory everything extending Throwable can be cached -> casting to
Exception is  not safe as it can throw ClassCastException
  • Loading branch information
jerrinot authored and smillidge committed Oct 23, 2016
1 parent 92cab13 commit ab3292b
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public Object cacheResult(InvocationContext ctx) throws Throwable {
// check exception cache
if (cacheExceptions) {
Cache exceptionCache = resolverF.getExceptionCacheResolver(pctx).resolveCache(pctx);
Exception e = (Exception) exceptionCache.get(key);
Throwable e = (Throwable) exceptionCache.get(key);
if (e != null) {
throw e;
}
Expand Down

0 comments on commit ab3292b

Please sign in to comment.