You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beam.apache.org by "Ted Yu (JIRA)" <ji...@apache.org> on 2017/04/04 21:02:41 UTC

[jira] [Comment Edited] (BEAM-1832) Potentially unclosed OutputStream in ApexYarnLauncher

    [ https://issues.apache.org/jira/browse/BEAM-1832?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15947383#comment-15947383 ] 

Ted Yu edited comment on BEAM-1832 at 4/4/17 9:02 PM:
------------------------------------------------------

In the same class:

{code}
  public static List<File> getYarnDeployDependencies() throws IOException {
    InputStream dependencyTree = ApexRunner.class.getResourceAsStream("dependency-tree");
{code}
dependencyTree should be closed even if exception is thrown in the while loop.


was (Author: yuzhihong@gmail.com):
In the same class:
{code}
  public static List<File> getYarnDeployDependencies() throws IOException {
    InputStream dependencyTree = ApexRunner.class.getResourceAsStream("dependency-tree");
{code}
dependencyTree should be closed even if exception is thrown in the while loop.

> Potentially unclosed OutputStream in ApexYarnLauncher
> -----------------------------------------------------
>
>                 Key: BEAM-1832
>                 URL: https://issues.apache.org/jira/browse/BEAM-1832
>             Project: Beam
>          Issue Type: Bug
>          Components: runner-apex
>            Reporter: Ted Yu
>            Priority: Minor
>
> Here is an example from createJar():
> {code}
>       final OutputStream out = Files.newOutputStream(zipfs.getPath(JarFile.MANIFEST_NAME));
>       if (!manifestFile.exists()) {
>         new Manifest().write(out);
>       } else {
>         FileUtils.copyFile(manifestFile, out);
>       }
>       out.close();
> {code}
> If FileUtils.copyFile throws IOException, out would be left unclosed.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)