You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2021/10/18 12:34:14 UTC

[GitHub] [ozone] adoroszlai commented on a change in pull request #2741: HDDS-5858. Fix resource leak due to Files.list

adoroszlai commented on a change in pull request #2741:
URL: https://github.com/apache/ozone/pull/2741#discussion_r730873575



##########
File path: hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/container/ContainerCommands.java
##########
@@ -168,14 +169,15 @@ public ContainerController getController() {
 
   private String getClusterId(String storageDir) throws IOException {
     Preconditions.checkNotNull(storageDir);
-    final Path firstStorageDirPath = Files.list(Paths.get(storageDir, "hdds"))
-        .filter(Files::isDirectory)
+    try (Stream<Path> stream = Files.list(Paths.get(storageDir, "hdds"))) {
+      final Path firstStorageDirPath = stream.filter(Files::isDirectory)
         .findFirst().get().getFileName();

Review comment:
       ```
   hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/debug/container/ContainerCommands.java
    174: '.' has incorrect indentation level 8, expected level should be 10.
   ```
   
   This line should be indented one more level.




-- 
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: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org