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

Norman Maurer commented on JAMES-1207:
--------------------------------------

@Felix:

Do you have time to review and fix ?

> Avoid file descriptor leaks
> ---------------------------
>
>                 Key: JAMES-1207
>                 URL: https://issues.apache.org/jira/browse/JAMES-1207
>             Project: JAMES Server
>          Issue Type: Task
>    Affects Versions: Trunk
>         Environment: All
>            Reporter: Felix Knecht
>
> Make sure, created streams get closed at least in a finally block to avoid 
> file descriptor leaks. E.g. in code below it's not known if LineNumberReader 
> closed the given created stream
>         try {
>             LineNumberReader counter;
>             if (getEncoding() != null) {
>                 counter = new LineNumberReader(new InputStreamReader(in, 
> getEncoding()));
>             } else {
>                 counter = new LineNumberReader(new InputStreamReader(in));
>             }
>             //Read through all the data
>             char[] block = new char[4096];
>             while (counter.read(block) > -1) {
>                 //Just keep reading
>             }
>             return counter.getLineNumber();
>         } catch (IOException ioe) {
>             return -1;
>         } finally {
>             IOUtils.closeQuietly(in);
>         }

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org
For additional commands, e-mail: server-dev-h...@james.apache.org

Reply via email to