[
https://issues.apache.org/jira/browse/JAMES-1207?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Felix Knecht closed JAMES-1207.
-------------------------------
> 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
> Assignee: Felix Knecht
> Fix For: 3.0-beta4
>
>
> 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: [email protected]
For additional commands, e-mail: [email protected]