adoroszlai commented on code in PR #10007:
URL: https://github.com/apache/ozone/pull/10007#discussion_r3020185386


##########
hadoop-hdds/client/src/main/java/org/apache/hadoop/hdds/scm/XceiverClientManager.java:
##########
@@ -163,7 +163,9 @@ protected XceiverClientSpi getClient(Pipeline pipeline, 
boolean topologyAware)
 
   private String getPipelineCacheKey(Pipeline pipeline,
                                      boolean topologyAware) {
-    String key = pipeline.getId().getId().toString() + pipeline.getType();
+    StringBuilder key = new StringBuilder()
+        .append(pipeline.getId().getId().toString())

Review Comment:
   nit: unnecessary `toString()`
   
   ```suggestion
           .append(pipeline.getId().getId())
   ```



##########
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/db/RDBCheckpointManager.java:
##########
@@ -62,16 +62,16 @@ public RocksDBCheckpoint createCheckpoint(String parentDir, 
String name) {
     try {
       long currentTime = System.currentTimeMillis();
 
-      String checkpointDir = StringUtils.EMPTY;
+      StringBuilder checkpointDir = new StringBuilder();
       if (StringUtils.isNotEmpty(checkpointNamePrefix)) {
-        checkpointDir += checkpointNamePrefix;
+        checkpointDir.append(checkpointNamePrefix);
       }
       if (name == null) {
         name = "_" + RDB_CHECKPOINT_DIR_PREFIX + currentTime;
       }
-      checkpointDir += name;
+      checkpointDir.append(name);

Review Comment:
   String concatenation can be changed to use the outer `StringBuilder`:
   
   ```java
         if (name == null) {
           checkpointDir.append('_')
               .append(RDB_CHECKPOINT_DIR_PREFIX)
               .append(currentTime);
         } else {
           checkpointDir.append(name);
         }
   ```



##########
hadoop-ozone/recon/src/main/java/org/apache/hadoop/ozone/recon/api/handlers/BucketHandler.java:
##########
@@ -99,6 +99,7 @@ public abstract OmDirectoryInfo getDirInfo(String[] names)
    * @param nextLevel
    * @return subpath
    */
+  @SuppressWarnings("PMD.UseStringBufferForStringAppends")

Review Comment:
   The first `StringBuilder` is no needed.
   
   ```java
   String subpath = !path.startsWith(OM_KEY_PREFIX)
       ? OM_KEY_PREFIX + path
       : path;
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to