+ if (instance != null) {
+ instance.uncaughtException(Thread.currentThread(), t);
+ }
+ }
+ }
+
+
+ /**
+ * Detect various non-fatal Sun JRE bugs.
+ *
+ * @param t the throwable
+ * @return whether this exception should be ignored
+ */
+ private static boolean isNonFatalJREBug(Throwable t) {
+
+ // NOTE: Calling method logs the entire throwable, so log only message here
+
+ /*
+ * Detect and ignore bug 6828938 in Sun JRE 1.6.0_14 - 1.6.0_16.
+ */
+ if (t instanceof ArrayIndexOutOfBoundsException) {
+ final String buggyClass = "sun.font.FontDesignMetrics";
+ StackTraceElement[] elements = t.getStackTrace();
+ if (elements.length >= 3 &&
+ (buggyClass.equals(elements[0].getClassName()) ||
+ buggyClass.equals(elements[1].getClassName()) ||
+ buggyClass.equals(elements[2].getClassName()))) {
+ log.warn("Ignoring Sun JRE bug 6828938: " +
+ "(see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6828938): " + t);
+ return true;
+ }
+ }
+
+ /*
+ * Detect and ignore bug 6561072 in Sun JRE 1.6.0_?
+ */
+ if (t instanceof NullPointerException) {
+ StackTraceElement[] trace = t.getStackTrace();