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

Swarnim Kulkarni commented on HADOOP-10517:
-------------------------------------------

It looks like there is a bug which we can fix with this JIRA. The closeEntry is 
called twice, Once here[1] and second here[2]. So if the "if" portion gets 
executed, we try to close the entry twice resulting in the error in the JUnit. 
I think we can remove the one inside "if" to fix the issue.

[1] 
https://github.com/apache/hadoop-common/blob/trunk/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/JarFinder.java#L67
[2] 
https://github.com/apache/hadoop-common/blob/trunk/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/util/JarFinder.java#L72

> InputStream is not closed in two methods of JarFinder
> -----------------------------------------------------
>
>                 Key: HADOOP-10517
>                 URL: https://issues.apache.org/jira/browse/HADOOP-10517
>             Project: Hadoop Common
>          Issue Type: Bug
>            Reporter: Ted Yu
>            Assignee: Ted Yu
>            Priority: Minor
>         Attachments: HADOOP-10517.1.patch.txt, hadoop-10517-v1.txt, 
> hadoop-10517-v2.txt
>
>
> JarFinder#jarDir() and JarFinder#zipDir() have such code:
> {code}
>                  InputStream is = new FileInputStream(f);
>                  copyToZipStream(is, anEntry, zos);
> {code}
> The InputStream is closed in copyToZipStream() but should be enclosed in 
> finally block.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to