You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@fluo.apache.org by GitBox <gi...@apache.org> on 2017/12/26 15:41:55 UTC

[GitHub] mikewalch commented on a change in pull request #988: Closed file system which is not eventually closed.

mikewalch commented on a change in pull request #988: Closed file system which is not eventually closed.
URL: https://github.com/apache/fluo/pull/988#discussion_r158716044
 
 

 ##########
 File path: modules/core/src/main/java/org/apache/fluo/core/client/FluoAdminImpl.java
 ##########
 @@ -340,12 +338,20 @@ private String copyJarsToDfs(String jars, String destDir) {
     String dfsAppRoot = config.getDfsRoot() + "/" + config.getApplicationName();
     String dfsDestDir = dfsAppRoot + "/" + destDir;
 
-    FileSystem fs;
+    FileSystem fs = null;
     try {
       fs = FileSystem.get(new URI(config.getDfsRoot()), new Configuration());
       fs.mkdirs(new Path(dfsDestDir));
     } catch (Exception e) {
       throw new IllegalStateException(e);
+    } finally {
+      if (fs != null) {
+        try {
+          fs.close();
 
 Review comment:
   The `fs` variable is used later on in the method so it shouldn't be closed in the `finally` block.  Maybe all uses of fs in the method should be wrapped with a try-with-resources block.

----------------------------------------------------------------
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