Re: closeQuietly() for stream try/catch
That makes sense. Thanks! On Apr 16, 2017 8:58 AM, "William Colen"wrote: We try to avoid external dependencies, including Apache Commons. Take a look if it is possible to use try-with-resources statement. Thank you, William 2017-04-16 8:46 GMT-03:00 Jeff Zemerick : > In cases of code like this when closing a stream: > > finally { > try { > sampleStream.close(); > } catch (IOException e) { > // sorry that this can fail > } > } > > I thought it might be a bit cleaner looking to replace the empty try/catch > with Apache Commons IO's IOUtils.closeQuietly(). I noticed that the Apache > Commons IO dependency's scope is currently set to test. If > you agree that the code change would be cleaner, is there any problem with > changing that dependency to a compile dependency instead of test? > > Thanks, > Jeff >
Re: closeQuietly() for stream try/catch
We try to avoid external dependencies, including Apache Commons. Take a look if it is possible to use try-with-resources statement. Thank you, William 2017-04-16 8:46 GMT-03:00 Jeff Zemerick: > In cases of code like this when closing a stream: > > finally { > try { > sampleStream.close(); > } catch (IOException e) { > // sorry that this can fail > } > } > > I thought it might be a bit cleaner looking to replace the empty try/catch > with Apache Commons IO's IOUtils.closeQuietly(). I noticed that the Apache > Commons IO dependency's scope is currently set to test. If > you agree that the code change would be cleaner, is there any problem with > changing that dependency to a compile dependency instead of test? > > Thanks, > Jeff >