我通常这样做:
try { // Use the resource.} catch( Exception ex ) { // Problem with the resource.} finally { // Put away the resource. closeQuietly( resource );}别处:
protected void closeQuietly( Resource resource ) { try { if (resource != null) { resource.close(); } } catch( Exception ex ) { log( "Exception during Resource.close()", ex ); }}


