[
https://issues.apache.org/jira/browse/SLIDER-374?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14158245#comment-14158245
]
Ted Yu commented on SLIDER-374:
-------------------------------
{code}
+ try{
+ targetKeystoreOutputStream = new FileOutputStream(targetKeystoreFile);
+ keystore.store(targetKeystoreOutputStream, truststorePassword);
+ }finally{
+ targetKeystoreOutputStream.close();
{code}
It's better to check whether targetKeystoreOutputStream is null in the finally
block.
nit: leave space between keyword and the curly. e.g.
{code}
+ } finally {
{code}
> Potential resource leak in accumulo/CertUtil.java due to unclosed streams
> -------------------------------------------------------------------------
>
> Key: SLIDER-374
> URL: https://issues.apache.org/jira/browse/SLIDER-374
> Project: Slider
> Issue Type: Bug
> Reporter: Ted Yu
> Assignee: thomas liu
> Priority: Minor
> Attachments: aslider374-patch, slider374.patch
>
>
> In
> app-packages/accumulo/src/test/java/org/apache/slider/funtest/accumulo/CertUtil.java
> :
> {code}
> signerKeystore.load(new FileInputStream(rootKeystorePath),
> signerPasswordArray);
> {code}
> The load() call doesn't close the passed in stream.
> The caller should close it.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)