[
https://issues.apache.org/jira/browse/HADOOP-10541?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13987986#comment-13987986
]
Chris Nauroth commented on HADOOP-10541:
----------------------------------------
Hi, [~swarnim]. Thank you for providing the patch.
I still see a few opportunities for a resource leak in this code. For {{is1}},
there is a call to {{IOUtils#toString}} outside the try block. This can throw
{{IOException}}, which would then result in {{is1}} not being closed. For
{{is2}}, there is a similar situation with {{BufferedReader#readLine}}, which
can throw {{IOException}}. In both cases, I recommend moving the calls that
can throw inside the try block. These are existing issues that weren't
introduced by your new patch, but it would be convenient to clean them up now,
since you're changing this code path anyway.
Also, the standard indentation for the project is to indent by 2 spaces (no
tabs). I saw a few tabs in your patch, so would you please convert those to 2
spaces?
Thanks again!
> InputStream in MiniKdc#initKDCServer for minikdc.ldiff is not closed
> --------------------------------------------------------------------
>
> Key: HADOOP-10541
> URL: https://issues.apache.org/jira/browse/HADOOP-10541
> Project: Hadoop Common
> Issue Type: Bug
> Components: test
> Affects Versions: 3.0.0, 2.4.0
> Reporter: Ted Yu
> Assignee: Swarnim Kulkarni
> Priority: Minor
> Attachments: HADOOP-10541.1.patch.txt
>
>
> The same InputStream variable is used for minikdc.ldiff and minikdc-krb5.conf
> :
> {code}
> InputStream is = cl.getResourceAsStream("minikdc.ldiff");
> ...
> is = cl.getResourceAsStream("minikdc-krb5.conf");
> {code}
> Before the second assignment, is should be closed.
--
This message was sent by Atlassian JIRA
(v6.2#6252)