|
11 | 11 | import org.springframework.jdbc.core.RowMapper; |
12 | 12 |
|
13 | 13 | import java.lang.annotation.Annotation; |
| 14 | +import java.lang.reflect.InvocationTargetException; |
14 | 15 | import java.lang.reflect.Method; |
15 | 16 | import java.lang.reflect.ParameterizedType; |
16 | 17 | import java.lang.reflect.Type; |
@@ -41,8 +42,8 @@ List<Method> findSProcCallAnnotatedMethods(Class c) { |
41 | 42 | private RowMapper getRowMapper(SProcCall scA) { |
42 | 43 | if (scA.resultMapper() != Void.class) { |
43 | 44 | try { |
44 | | - return (RowMapper<?>) scA.resultMapper().newInstance(); |
45 | | - } catch (final InstantiationException | IllegalAccessException ex) { |
| 45 | + return (RowMapper<?>) scA.resultMapper().getDeclaredConstructor().newInstance(); |
| 46 | + } catch (final InstantiationException | IllegalAccessException | SecurityException | InvocationTargetException | IllegalArgumentException | NoSuchMethodException ex) { |
46 | 47 | LOG.error("Result mapper for sproc can not be instantiated", ex); |
47 | 48 | throw new IllegalArgumentException("Result mapper for sproc can not be instantiated"); |
48 | 49 | } |
@@ -113,8 +114,8 @@ public Map<Method, StoredProcedure> handle(Class c, SProcServiceAnnotationHandle |
113 | 114 | VirtualShardKeyStrategy sprocStrategy = handlerResult.getShardKeyStrategy(); |
114 | 115 | if (scA.shardStrategy() != Void.class) { |
115 | 116 | try { |
116 | | - sprocStrategy = (VirtualShardKeyStrategy) scA.shardStrategy().newInstance(); |
117 | | - } catch (final InstantiationException | IllegalAccessException ex) { |
| 117 | + sprocStrategy = (VirtualShardKeyStrategy) scA.shardStrategy().getDeclaredConstructor().newInstance(); |
| 118 | + } catch (final InstantiationException | IllegalAccessException | SecurityException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException ex) { |
118 | 119 | LOG.error("Shard strategy for sproc can not be instantiated", ex); |
119 | 120 | throw new IllegalArgumentException("Shard strategy for sproc can not be instantiated"); |
120 | 121 | } |
@@ -153,7 +154,7 @@ public Map<Method, StoredProcedure> handle(Class c, SProcServiceAnnotationHandle |
153 | 154 | try { |
154 | 155 | params.add(StoredProcedureParameter.createParameter(clazz, genericType, |
155 | 156 | method, dbTypeName, sParam.sqlType(), pos, sParam.sensitive())); |
156 | | - } catch (final InstantiationException | IllegalAccessException e) { |
| 157 | + } catch (final InstantiationException | IllegalAccessException | NoSuchMethodException | IllegalArgumentException | SecurityException | InvocationTargetException e) { |
157 | 158 | LOG.error("Could not instantiate StoredProcedureParameter. ABORTING.", e); |
158 | 159 | throw new IllegalArgumentException("Could not instantiate StoredProcedureParameter. ABORTING."); |
159 | 160 | } |
@@ -184,7 +185,7 @@ private StoredProcedure createStoredProcedure(SProcCall scA, SProcServiceAnnotat |
184 | 185 | writeTransaction); |
185 | 186 |
|
186 | 187 | return storedProcedure; |
187 | | - } catch (final InstantiationException | IllegalAccessException e) { |
| 188 | + } catch (final InstantiationException | IllegalAccessException | NoSuchMethodException | IllegalArgumentException | SecurityException | InvocationTargetException e) { |
188 | 189 | LOG.error("Could not instantiate StoredProcedure. ABORTING.", e); |
189 | 190 | throw new IllegalArgumentException("Could not instantiate StoredProcedure. ABORTING."); |
190 | 191 | } |
|
0 commit comments