From 498b857b3a51b204894df71aa97e703e04b0154a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E7=A6=B9=E5=85=89?= Date: Fri, 11 Jan 2019 16:21:28 +0800 Subject: [PATCH] Optimize code: remove unnecessary judgment code. --- .../dubbo/common/utils/CompatibleTypeUtils.java | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/utils/CompatibleTypeUtils.java b/dubbo-common/src/main/java/org/apache/dubbo/common/utils/CompatibleTypeUtils.java index de96eebda18..efc570fe925 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/common/utils/CompatibleTypeUtils.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/common/utils/CompatibleTypeUtils.java @@ -104,15 +104,10 @@ public static Object compatibleTypeConvert(Object value, Class type) { // Process string to char array for generic invoke // See // - https://github.com/apache/incubator-dubbo/issues/2003 - if (string == null) { - return null; - } - else { - int len = string.length(); - char[] chars = new char[len]; - string.getChars(0, len, chars, 0); - return chars; - } + int len = string.length(); + char[] chars = new char[len]; + string.getChars(0, len, chars, 0); + return chars; } } else if (value instanceof Number) { Number number = (Number) value;