From 48490696a4eec8db45571e4f5d31dfc9b5549e81 Mon Sep 17 00:00:00 2001 From: crusader Date: Fri, 4 May 2018 19:00:02 +0900 Subject: [PATCH] ing --- .../json/JSONRPCClientNotificationCodec.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/loafle/commons/rpc/protocol/json/JSONRPCClientNotificationCodec.java b/src/main/java/com/loafle/commons/rpc/protocol/json/JSONRPCClientNotificationCodec.java index 8c01e00..173c7fc 100644 --- a/src/main/java/com/loafle/commons/rpc/protocol/json/JSONRPCClientNotificationCodec.java +++ b/src/main/java/com/loafle/commons/rpc/protocol/json/JSONRPCClientNotificationCodec.java @@ -52,15 +52,16 @@ public class JSONRPCClientNotificationCodec implements RPCClientNotificationCode Type paramType = paramTypes[i]; String param = this.notification.params.get(i); - JavaType targetType = objectMapper.getTypeFactory().constructType(paramType); - if (!Primitives.isPrimitive(paramType) && !paramType.getTypeName().equals(String.class.getName())) { - try { + try { + JavaType targetType = objectMapper.getTypeFactory().constructType(paramType); + if (!Primitives.isPrimitive(paramType) && !paramType.getTypeName().equals(String.class.getName())) { result[i] = objectMapper.readValue(param, targetType); - } catch (IOException e) { - throw new IllegalArgumentException(); + } else { + result[i] = objectMapper.convertValue(param, targetType); } + } catch (IOException e) { + throw new IllegalArgumentException(); } - result[i] = objectMapper.convertValue(param, targetType); } return result;