static Throwable tryClose ( AutoCloseable closeable , boolean logWarning ) { Throwable thrown = null ; if ( closeable != null ) { try { closeable . close ( ) ; } catch ( Exception e ) { thrown = e ; if ( logWarning ) { LOG . warning ( "Caught exception during close(): " + e ) ; } } } return thrown ; }
Attempts to close the closeable returning rather than throwing any Exception that may occur .