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

Sebb commented on CSV-176:
--------------------------

Not sure what resource can leak here.

Note that the Javadoc [1] for StringWriter#close() says:

"Closing a StringWriter has no effect."

[1] 
https://docs.oracle.com/javase/7/docs/api/java/io/StringWriter.html#close%28%29

> Resource leak: StringWriter is never closed in CSVFormate.java
> --------------------------------------------------------------
>
>                 Key: CSV-176
>                 URL: https://issues.apache.org/jira/browse/CSV-176
>             Project: Commons CSV
>          Issue Type: Improvement
>            Reporter: Pratiyush
>            Priority: Minor
>
> public String format(final Object... values) {
>         final StringWriter out = new StringWriter();
>         try {
>             new CSVPrinter(out, this).printRecord(values);
>             return out.toString().trim();
>         } catch (final IOException e) {
>             // should not happen because a StringWriter does not do IO.
>             throw new IllegalStateException(e); 
>         }
>     }



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

Reply via email to