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

ASF GitHub Bot commented on FLINK-2595:
---------------------------------------

Github user fhueske commented on a diff in the pull request:

    https://github.com/apache/flink/pull/1137#discussion_r39676482
  
    --- Diff: 
flink-runtime/src/test/java/org/apache/flink/runtime/util/ClassLoaderUtilsTest.java
 ---
    @@ -46,13 +46,16 @@ public void testWithURLClassLoader() {
                        jarFileCreator.createJarFile();
                        
                        // validate that the JAR is correct and the test setup 
is not broken
    +                   JarFile jarFile = null;
                        try {
    -                           new JarFile(validJar.getAbsolutePath());
    +                           jarFile = new 
JarFile(validJar.getAbsolutePath());
                        }
                        catch (Exception e) {
                                e.printStackTrace();
                                fail("test setup broken: cannot create a valid 
jar file");
    -                   }
    +                   } finally {
    +                                if (jarFile != null) jarFile.close();
    --- End diff --
    
    We use tabs for indention in Java code. Can you fix this and the next line?


> Unclosed JarFile may leak resource in ClassLoaderUtilsTest
> ----------------------------------------------------------
>
>                 Key: FLINK-2595
>                 URL: https://issues.apache.org/jira/browse/FLINK-2595
>             Project: Flink
>          Issue Type: Test
>            Reporter: Ted Yu
>            Priority: Minor
>
> Here is related code:
> {code}
>                         try {
>                                 new JarFile(validJar.getAbsolutePath());
>                         }
>                         catch (Exception e) {
>                                 e.printStackTrace();
>                                 fail("test setup broken: cannot create a 
> valid jar file");
>                         }
> {code}
> When no exception happens, the JarFile instance is not closed.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to