You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@geode.apache.org by GitBox <gi...@apache.org> on 2020/10/13 19:19:39 UTC

[GitHub] [geode] upthewaterspout commented on a change in pull request #5582: GEODE-7864: Fix potential resource leak LGTM warnings

upthewaterspout commented on a change in pull request #5582:
URL: https://github.com/apache/geode/pull/5582#discussion_r504198531



##########
File path: geode-gfsh/src/main/java/org/apache/geode/management/internal/cli/commands/DeployCommand.java
##########
@@ -101,26 +101,36 @@ public ResultModel deploy(
     for (DistributedMember member : targetMembers) {
       List<RemoteInputStream> remoteStreams = new ArrayList<>();
       List<String> jarNames = new ArrayList<>();
-      for (String jarFullPath : jarFullPaths) {
-        remoteStreams
-            .add(exporter.export(new SimpleRemoteInputStream(new FileInputStream(jarFullPath))));
-        jarNames.add(FilenameUtils.getName(jarFullPath));
-      }
-
-      // this deploys the jars to all the matching servers
-      ResultCollector<?, ?> resultCollector =
-          executeFunction(this.deployFunction, new Object[] {jarNames, remoteStreams}, member);
-
-      @SuppressWarnings("unchecked")
-      final List<List<Object>> resultCollectorResult =
-          (List<List<Object>>) resultCollector.getResult();
-      results.add(resultCollectorResult.get(0));
+      try {
+        for (String jarFullPath : jarFullPaths) {
+          FileInputStream fileInputStream = null;
+          try {
+            fileInputStream = new FileInputStream(jarFullPath);
+            remoteStreams.add(exporter.export(new SimpleRemoteInputStream(fileInputStream)));
+            jarNames.add(FilenameUtils.getName(jarFullPath));
+          } catch (Exception ex) {
+            if (fileInputStream != null) {
+              fileInputStream.close();

Review comment:
       Does this need to swallow IOExceptions?




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

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