@Test public void testReportError() { MailHandler instance = new MailHandler(createInitProperties("")); instance.setErrorManager(new ErrorManager() { @Override public void error(String msg, Exception ex, int code) { assertNull(msg); } }); instance.reportError(null, null, ErrorManager.GENERIC_FAILURE); instance.setErrorManager(new ErrorManager() { @Override public void error(String msg, Exception ex, int code) { assertEquals(msg.indexOf(Level.SEVERE.getName()), 0); } }); instance.reportError("simple message.", null, ErrorManager.GENERIC_FAILURE); instance.close(); instance = createHandlerWithRecords(); instance.setErrorManager(new MessageErrorManager(instance.getMailProperties()) { @Override protected void error(MimeMessage message, Throwable t, int code) { try { assertTrue(message.getHeader("X-Mailer")[0].startsWith(MailHandler.class.getName())); assertTrue(null != message.getSentDate()); message.saveChanges(); } catch (MessagingException ME) { fail(ME.toString()); } } }); instance.close(); }
@Override 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); } }
MailHandler extends Handler { @Override 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); } } }
MailHandler extends Handler { @Override 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); } } MailHandler();  MailHandler(final int capacity);  MailHandler(final Properties props); }
MailHandler extends Handler { @Override 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); } } MailHandler();  MailHandler(final int capacity);  MailHandler(final Properties props); @Override boolean isLoggable(final LogRecord record); void publish(final LogRecord record); void push(); void flush(); void close(); @Override synchronized void setLevel(final Level newLevel); final synchronized Level getPushLevel(); final synchronized void setPushLevel(final Level level); final synchronized Filter getPushFilter(); final synchronized void setPushFilter(final Filter filter); final synchronized Comparator<? super LogRecord> getComparator(); final synchronized void setComparator(Comparator<? super LogRecord> c); final synchronized int getCapacity(); final synchronized Authenticator getAuthenticator(); final void setAuthenticator(final Authenticator auth); final void setAuthenticator(final char... password); final void setMailProperties(Properties props); final Properties getMailProperties(); final Filter[] getAttachmentFilters(); final void setAttachmentFilters(Filter... filters); final Formatter[] getAttachmentFormatters(); final void setAttachmentFormatters(Formatter... formatters); final Formatter[] getAttachmentNames(); final void setAttachmentNames(final String... names); final void setAttachmentNames(Formatter... formatters); final synchronized Formatter getSubject(); final void setSubject(final String subject); final void setSubject(final Formatter format); }
MailHandler extends Handler { @Override 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); } } MailHandler();  MailHandler(final int capacity);  MailHandler(final Properties props); @Override boolean isLoggable(final LogRecord record); void publish(final LogRecord record); void push(); void flush(); void close(); @Override synchronized void setLevel(final Level newLevel); final synchronized Level getPushLevel(); final synchronized void setPushLevel(final Level level); final synchronized Filter getPushFilter(); final synchronized void setPushFilter(final Filter filter); final synchronized Comparator<? super LogRecord> getComparator(); final synchronized void setComparator(Comparator<? super LogRecord> c); final synchronized int getCapacity(); final synchronized Authenticator getAuthenticator(); final void setAuthenticator(final Authenticator auth); final void setAuthenticator(final char... password); final void setMailProperties(Properties props); final Properties getMailProperties(); final Filter[] getAttachmentFilters(); final void setAttachmentFilters(Filter... filters); final Formatter[] getAttachmentFormatters(); final void setAttachmentFormatters(Formatter... formatters); final Formatter[] getAttachmentNames(); final void setAttachmentNames(final String... names); final void setAttachmentNames(Formatter... formatters); final synchronized Formatter getSubject(); final void setSubject(final String subject); final void setSubject(final Formatter format);  }