You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by th...@apache.org on 2017/04/08 04:46:48 UTC

[2/3] beam git commit: Fix for potentially unclosed streams in ApexYarnLauncher

Fix for potentially unclosed streams in ApexYarnLauncher


Project: http://git-wip-us.apache.org/repos/asf/beam/repo
Commit: http://git-wip-us.apache.org/repos/asf/beam/commit/564c17ac
Tree: http://git-wip-us.apache.org/repos/asf/beam/tree/564c17ac
Diff: http://git-wip-us.apache.org/repos/asf/beam/diff/564c17ac

Branch: refs/heads/master
Commit: 564c17acfc966b6f66c36b3eac0f9f76794b7d4d
Parents: ca4fae4
Author: rjoshi2 <re...@gmail.com>
Authored: Fri Apr 7 19:15:12 2017 -0700
Committer: rjoshi2 <re...@gmail.com>
Committed: Fri Apr 7 19:15:12 2017 -0700

----------------------------------------------------------------------
 .../java/org/apache/beam/runners/apex/ApexYarnLauncher.java    | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/beam/blob/564c17ac/runners/apex/src/main/java/org/apache/beam/runners/apex/ApexYarnLauncher.java
----------------------------------------------------------------------
diff --git a/runners/apex/src/main/java/org/apache/beam/runners/apex/ApexYarnLauncher.java b/runners/apex/src/main/java/org/apache/beam/runners/apex/ApexYarnLauncher.java
index e162d85..198b9bf 100644
--- a/runners/apex/src/main/java/org/apache/beam/runners/apex/ApexYarnLauncher.java
+++ b/runners/apex/src/main/java/org/apache/beam/runners/apex/ApexYarnLauncher.java
@@ -275,9 +275,9 @@ public class ApexYarnLauncher {
         public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
           String name = relativePath + file.getFileName();
           if (!JarFile.MANIFEST_NAME.equals(name)) {
-            final OutputStream out = Files.newOutputStream(zipfs.getPath(name));
-            FileUtils.copyFile(file.toFile(), out);
-            out.close();
+            try (final OutputStream out = Files.newOutputStream(zipfs.getPath(name))) {
+              FileUtils.copyFile(file.toFile(), out);
+            }
           }
           return super.visitFile(file, attrs);
         }