[jira] [Commented] (FLINK-2595) Unclosed JarFile may leak resource in ClassLoaderUtilsTest

2015-09-17 Thread ASF GitHub Bot (JIRA)

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

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

Github user fhueske commented on the pull request:

https://github.com/apache/flink/pull/1137#issuecomment-141006345
  
Thanks for the update.
Will merge this now.


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


[jira] [Commented] (FLINK-2595) Unclosed JarFile may leak resource in ClassLoaderUtilsTest

2015-09-16 Thread Ufuk Celebi (JIRA)

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

Ufuk Celebi commented on FLINK-2595:


Hey Ted, would you like to provide a fix for this?

> 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 exception happens, the JarFile instance is not closed.



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


[jira] [Commented] (FLINK-2595) Unclosed JarFile may leak resource in ClassLoaderUtilsTest

2015-09-16 Thread ASF GitHub Bot (JIRA)

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

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

GitHub user tedyu opened a pull request:

https://github.com/apache/flink/pull/1137

FLINK-2595 Unclosed JarFile may leak resource in ClassLoaderUtilsTest



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/tedyu/flink master

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/flink/pull/1137.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #1137


commit 705fa05121a6a2732e2604148653705a419f4d60
Author: Ted 
Date:   2015-09-16T16:29:54Z

FLINK-2595 Unclosed JarFile may leak resource in ClassLoaderUtilsTest




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


[jira] [Commented] (FLINK-2595) Unclosed JarFile may leak resource in ClassLoaderUtilsTest

2015-09-16 Thread ASF GitHub Bot (JIRA)

[ 
https://issues.apache.org/jira/browse/FLINK-2595?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=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)


[jira] [Commented] (FLINK-2595) Unclosed JarFile may leak resource in ClassLoaderUtilsTest

2015-09-16 Thread ASF GitHub Bot (JIRA)

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

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

Github user fhueske commented on the pull request:

https://github.com/apache/flink/pull/1137#issuecomment-140868278
  
Hi @tedyu,
Thanks for the pull request!
It's good to merge after the the indention is fixed.


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