On 6 February 2014 13:53, Gary Gregory <[email protected]> wrote:
> Looking at code like DiskFileItem:684:
>
>             FileInputStream input = new FileInputStream(dfosFile);
>             IOUtils.copy(input, output);
>
> Why is this not:
>
>             FileInputStream input = new FileInputStream(dfosFile);
>             try {
>                 IOUtils.copy(input, output);
>             } finally {
>                 input.close();
>             }
>
> ?

Oversight?

The local Streams.copy() methods do close input and optionally output.
Maybe it was thought IO did the same?

The close should perhaps be

IOUtils.closeQuietly()

Are we interested in knowibg about input close() failures?

> Gary
>
>
> --
> E-Mail: [email protected] | [email protected]
> Java Persistence with Hibernate, Second 
> Edition<http://www.manning.com/bauer3/>
> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
> Spring Batch in Action <http://www.manning.com/templier/>
> Blog: http://garygregory.wordpress.com
> Home: http://garygregory.com/
> Tweet! http://twitter.com/GaryGregory

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to