From ff23a3fc91ce5e7ff538d9adbbce59a27ce3bc30 Mon Sep 17 00:00:00 2001
From: Nikita <abracham.mitchell@gmail.com>
Date: Wed, 24 Jan 2018 10:04:06 +0300
Subject: [PATCH] Fixed - ValueRetrievalException shouldn't be wrapped by
 IllegalStateException. #1257

---
 .../org/redisson/spring/cache/RedissonCache.java  | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/redisson/src/main/java/org/redisson/spring/cache/RedissonCache.java b/redisson/src/main/java/org/redisson/spring/cache/RedissonCache.java
index 5ae73e626..c406b27b4 100644
--- a/redisson/src/main/java/org/redisson/spring/cache/RedissonCache.java
+++ b/redisson/src/main/java/org/redisson/spring/cache/RedissonCache.java
@@ -16,6 +16,7 @@
 package org.redisson.spring.cache;
 
 import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
 import java.util.concurrent.Callable;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicLong;
@@ -170,7 +171,19 @@ public class RedissonCache implements Cache {
                             Constructor<?> constructor = c.getConstructor(Object.class, Callable.class, Throwable.class);
                             RuntimeException exception = (RuntimeException) constructor.newInstance(key, valueLoader, ex.getCause());
                             throw exception;                
-                        } catch (Exception e) {
+                        } catch (ClassNotFoundException e) {
+                            throw new IllegalStateException(e);
+                        } catch (NoSuchMethodException e) {
+                            throw new IllegalStateException(e);
+                        } catch (SecurityException e) {
+                            throw new IllegalStateException(e);
+                        } catch (InstantiationException e) {
+                            throw new IllegalStateException(e);
+                        } catch (IllegalAccessException e) {
+                            throw new IllegalStateException(e);
+                        } catch (IllegalArgumentException e) {
+                            throw new IllegalStateException(e);
+                        } catch (InvocationTargetException e) {
                             throw new IllegalStateException(e);
                         }
                     }