From de204cf1879922ae64e2622e97aa36d690ab8a24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=8E=E7=8E=89=E6=A1=94?= <769213327@qq.com> Date: Mon, 14 Jan 2019 23:34:29 +0800 Subject: [PATCH] Optimize code: remove unnecessary judgment code. (#3196) --- .../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;