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

Tsuyoshi OZAWA commented on HADOOP-10364:
-----------------------------------------

HI [~yunsh], thanks for your contribution. To avoid a resource leak, we should 
add try {} finally {} block and close dumpGenerator in finally block. 

{code}
+    dumpGenerator.close();
{code}

We should use IOUtils instead of using close() method directory, because 
close() can throw IOException and null check.

> JsonGenerator in Configuration#dumpConfiguration() is not closed
> ----------------------------------------------------------------
>
>                 Key: HADOOP-10364
>                 URL: https://issues.apache.org/jira/browse/HADOOP-10364
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: conf
>            Reporter: Ted Yu
>         Attachments: HADOOP-10364.patch
>
>
> {code}
>     JsonGenerator dumpGenerator = dumpFactory.createJsonGenerator(out);
> {code}
> dumpGenerator is not closed in Configuration#dumpConfiguration()
> Looking at the source code of 
> org.codehaus.jackson.impl.WriterBasedGenerator#close(), there is more than 
> flushing the buffer.



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

Reply via email to