public static void safeCloseStream(OutputStream out){
  if (out != null) {
    try {
      out.close();
    }
 catch (    Exception e) {
      log.error(e.getMessage(),e);
    }
  }
}

public static void safeCloseStream ( OutputStream out ) { if ( out != null ) { try { out . close ( ) ; } catch ( Exception e ) { log . error ( e . getMessage ( ) , e ) ; } } }
close streams without pain
