This is an automated email from the ASF dual-hosted git repository.
crazyhzm pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/master by this push:
new 0d09ef9 修复 CollectionUtils类toStringMap方法没有检查 pairs 参数是否为空. (#5102)
0d09ef9 is described below
commit 0d09ef9b5641c7f150e6c0f3471231db4a879bfd
Author: xiaoheng1 <[email protected]>
AuthorDate: Sun Sep 22 23:27:58 2019 +0800
修复 CollectionUtils类toStringMap方法没有检查 pairs 参数是否为空. (#5102)
* 修复 CollectionUtils类toStringMap方法没有检查 pairs 参数是否为空.
Fixed #5100
* 使用 ArrayUtils#isEmpty 方法检查 pairs 参数是否为空.
Fixed #5100
---
.../src/main/java/org/apache/dubbo/common/utils/CollectionUtils.java | 4 ++++
1 file changed, 4 insertions(+)
diff --git
a/dubbo-common/src/main/java/org/apache/dubbo/common/utils/CollectionUtils.java
b/dubbo-common/src/main/java/org/apache/dubbo/common/utils/CollectionUtils.java
index 40baecd..4e924b3 100644
---
a/dubbo-common/src/main/java/org/apache/dubbo/common/utils/CollectionUtils.java
+++
b/dubbo-common/src/main/java/org/apache/dubbo/common/utils/CollectionUtils.java
@@ -173,6 +173,10 @@ public class CollectionUtils {
public static Map<String, String> toStringMap(String... pairs) {
Map<String, String> parameters = new HashMap<>();
+ if(ArrayUtils.isEmpty(pairs)){
+ return parameters;
+ }
+
if (pairs.length > 0) {
if (pairs.length % 2 != 0) {
throw new IllegalArgumentException("pairs must be even.");