diff --git a/src/main/java/com/loafle/overflow/proxy/ServiceInvoker.java b/src/main/java/com/loafle/overflow/proxy/ServiceInvoker.java index 2f248ea..7bf22ab 100644 --- a/src/main/java/com/loafle/overflow/proxy/ServiceInvoker.java +++ b/src/main/java/com/loafle/overflow/proxy/ServiceInvoker.java @@ -169,9 +169,15 @@ public class ServiceInvoker { private Object getValue(Cache.ParameterCache parameterCache, String json) throws IOException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException { Object result = null; if (List.class == parameterCache.clazz) { + if (null == parameterCache.genericClazzes || 1 != parameterCache.genericClazzes.length) { + throw new IllegalArgumentException(); + } result = objectMapper.readValue(json, objectMapper.getTypeFactory().constructCollectionType(List.class, parameterCache.genericClazzes[0])); } else if (Map.class == parameterCache.clazz) { - + if (null == parameterCache.genericClazzes || 2 != parameterCache.genericClazzes.length) { + throw new IllegalArgumentException(); + } + result = objectMapper.readValue(json, objectMapper.getTypeFactory().constructMapType(Map.class, parameterCache.genericClazzes[0], parameterCache.genericClazzes[1])); } else if (parameterCache.clazz.isPrimitive()) { Class wrapperClazz = Primitives.wrap(parameterCache.clazz); Constructor con = wrapperClazz.getConstructor(String.class);