dubbo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] liketic commented on a change in pull request #1388: Remove unnecessary StringBuilder
Date Wed, 04 Apr 2018 14:33:27 GMT
liketic commented on a change in pull request #1388: Remove unnecessary StringBuilder
URL: https://github.com/apache/incubator-dubbo/pull/1388#discussion_r179162214
 
 

 ##########
 File path: dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/merger/ArrayMerger.java
 ##########
 @@ -34,9 +34,7 @@
             if (item != null && item.getClass().isArray()) {
                 totalLen += Array.getLength(item);
             } else {
-                throw new IllegalArgumentException(
-                        new StringBuilder(32).append(i + 1)
-                                .append("th argument is not an array").toString());
+                throw new IllegalArgumentException(i + 1 + "th argument is not an array");
 
 Review comment:
   Thanks @beiwei30 , we don't need to add the () explicitly.  A example:
   ```
       public static void main(String[] args) {
   
           int x = 10;
           throw new IllegalArgumentException(x + 1 + " illegal exception");
       }
   ```
   will get:
   ```
   Exception in thread "main" java.lang.IllegalArgumentException: 11 illegal exception
   ```
   Please correct me if I'm wrong.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message