@Override protected void reportError(final String s, final Exception e, final int i) { super.reportError(s, e, i); }
/** * Protected convenience method to report an error to this Handler's * ErrorManager. This method will prefix all non null error messages with * <tt>Level.SEVERE.getName()</tt>. This allows the receiving error * manager to determine if the <tt>msg</tt> parameter is a simple error * message or a raw email message. * @param msg a descriptive string (may be null) * @param ex an exception (may be null) * @param code an error code defined in ErrorManager */ protected void reportError(String msg, Exception ex, int code) { if (msg != null) { super.reportError(Level.SEVERE.getName() + ": " + msg, ex, code); } else { super.reportError(null, ex, code); } }
reportError(v, re, ErrorManager.OPEN_FAILURE); reportError("", e, ErrorManager.WRITE_FAILURE);
out = new BufferedWriter(fstream); } catch (IOException e) { reportError(e.getMessage(), e, ErrorManager.OPEN_FAILURE); reportError(e.getMessage(), e, ErrorManager.WRITE_FAILURE); reportError(e.getMessage(), e, ErrorManager.FLUSH_FAILURE); out.close(); } catch (IOException e) { reportError(e.getMessage(), e, ErrorManager.CLOSE_FAILURE);
reportError(null, fnfe, ErrorManager.GENERIC_FAILURE); fnfe.printStackTrace(System.err);
Handler consoleHandler = new Handler(){ @Override public void publish(LogRecord record) { if (getFormatter() == null) { setFormatter(new SimpleFormatter()); } try { String message = getFormatter().format(record); if (record.getLevel().intValue() >= Level.WARNING.intValue()) { System.err.write(message.getBytes()); } else { System.out.write(message.getBytes()); } } catch (Exception exception) { reportError(null, exception, ErrorManager.FORMAT_FAILURE); } } @Override public void close() throws SecurityException {} @Override public void flush(){} };
init(record); } catch (RuntimeException re) { reportError(null, re, ErrorManager.WRITE_FAILURE); } catch (Exception e) { reportError(null, e, ErrorManager.WRITE_FAILURE); reportError(null, e, ErrorManager.WRITE_FAILURE);
reportError(e.getMessage(), e, ErrorManager.FLUSH_FAILURE); outputStream.close(); } catch (IOException e) { reportError(e.getMessage(), e, ErrorManager.CLOSE_FAILURE); reportError(e.getMessage(), e, ErrorManager.OPEN_FAILURE); reportError(e.getMessage(), e, ErrorManager.GENERIC_FAILURE); writer.close(); } catch(Exception e) { reportError("Unable to rename old file: " + logFile.getName() + " to new file: " + newFile, null, ErrorManager.GENERIC_FAILURE); reportError(e.getMessage(), e, ErrorManager.OPEN_FAILURE); } catch (IOException e) { reportError(e.getMessage(), e, ErrorManager.OPEN_FAILURE); reportError(e.getMessage(), e, ErrorManager.WRITE_FAILURE);
this.reportError(null, jm, ErrorManager.WRITE_FAILURE);
/** * Converts a mime message to a raw string or formats the reason * why message can't be changed to raw string and reports it. * @param msg the mime message. * @param ex the original exception. * @param code the ErrorManager code. * @since JavaMail 1.4.5 */ private void reportError(Message msg, Exception ex, int code) { try { //Use super call so we do not prefix raw email. super.reportError(toRawString(msg), ex, code); } catch (final MessagingException rawMe) { reportError(toMsgString(rawMe), ex, code); } catch (final IOException rawIo) { reportError(toMsgString(rawIo), ex, code); } }
this.reportError(null, jm, ErrorManager.WRITE_FAILURE);
reportError(null, ex, ErrorManager.WRITE_FAILURE); mutex.close(); } catch (IOException ioe) { this.reportError(null, ioe, ErrorManager.CLOSE_FAILURE);