jt2594838 commented on a change in pull request #31: Fix sonar
URL: https://github.com/apache/incubator-iotdb/pull/31#discussion_r251001304
 
 

 ##########
 File path: 
iotdb/src/main/java/org/apache/iotdb/db/postback/receiver/ServerServiceImpl.java
 ##########
 @@ -129,13 +142,13 @@ public String startReceiving(String md5OfSender, 
List<String> filePathSplit,
       ByteBuffer dataToReceive, int status) throws TException {
     String md5OfReceiver = "";
     String filePath = "";
-    FileOutputStream fos = null;
     FileChannel channel = null;
     for (int i = 0; i < filePathSplit.size(); i++) {
       if (i == filePathSplit.size() - 1) {
-        filePath = filePath + filePathSplit.get(i);
+        filePath = new 
StringBuilder().append(filePath).append(filePathSplit.get(i)).toString();
       } else {
-        filePath = filePath + filePathSplit.get(i) + File.separator;
+        filePath = new 
StringBuilder().append(filePath).append(filePathSplit.get(i))
+            .append(File.separator).toString();
 
 Review comment:
   This is not how a StringBuilder works. You should initialize a single 
StringBuilder, call append() in the loop and call toString() when the loop ends.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to