Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
bgColor#ccccff
class MyExceptionReporter extends ExceptionReporter {
  private static final Logger logger =
      Logger.getLogger("com.organization.Log");

  public static void report(Throwable t) {
    try {
      final Throwable filteredException =
          (t instanceof NonSensitiveException_1) ? t : filter(t);
    } finally {
      // Do any necessary user reporting
      // (show dialog box or send to console)
      if (filteredException instanceof NonSensitiveCommonException) {
        logger.log(Level.FINEST, "Loggable exception occurred", t);
      }
    }
  }

  public static Exception filter(Throwable t) {
    if (t instanceof SensitiveForLoggingException_1) { 
      // Do not log sensitive information (blacklistwhitelist)
      return SensitiveCommonException();
    }
    // ...
    // Return for reporting to the user
    return new NonSensitiveCommonException(); 
  }
}

...

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="7969951457f2f55b-994eccf5-4a8b465f-9638bde6-581e087ae461de6a4d86ca92"><ac:plain-text-body><![CDATA[

[[Bloch 2008

AA. References#Bloch 08]]

Item 65. Don't ignore exceptions; Item 62. Document all exceptions thrown by each method

]]></ac:plain-text-body></ac:structured-macro>

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="83c7fb02cad5b67b-b66ee414-498544da-880792e8-4db893c4d195a01f7b8d1df2"><ac:plain-text-body><![CDATA[

[[Goetz 2006

AA. References#Goetz 06]]

5.4, Blocking and interruptible methods

]]></ac:plain-text-body></ac:structured-macro>

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="97f161c549304e07-06b4309c-4c5e4b07-b496b27c-06b8d7315d71a7de7e6e3782"><ac:plain-text-body><![CDATA[

[[JLS 2005

AA. References#JLS 05]]

[Chapter 11, Exceptions

http://java.sun.com/docs/books/jls/third_edition/html/exceptions.html]

]]></ac:plain-text-body></ac:structured-macro>

...