Merge branch 'upstream' into debian
[debian/openrocket] / src / net / sf / openrocket / gui / main / ExceptionHandler.java
index a3d51de3a66131a04fa9a9a179895912f998f7a3..83301da729d0645a2e3c26c398eb835002c55551 100644 (file)
@@ -113,7 +113,7 @@ public class ExceptionHandler implements Thread.UncaughtExceptionHandler {
         * @param message       the error message.
         * @param exception     the exception that occurred.
         */
-       public static void handleErrorCondition(String message, Exception exception) {
+       public static void handleErrorCondition(String message, Throwable exception) {
                log.error(1, message, exception);
                handleErrorCondition(new InternalException(message, exception));
        }
@@ -128,7 +128,7 @@ public class ExceptionHandler implements Thread.UncaughtExceptionHandler {
         * 
         * @param exception             the exception that occurred.
         */
-       public static void handleErrorCondition(final Exception exception) {
+       public static void handleErrorCondition(final Throwable exception) {
                try {
                        if (!(exception instanceof InternalException)) {
                                log.error(1, "Error occurred", exception);
@@ -301,6 +301,29 @@ public class ExceptionHandler implements Thread.UncaughtExceptionHandler {
                
                // NOTE:  Calling method logs the entire throwable, so log only message here
                
+
+               /*
+                * Detect and ignore bug 6826104 in Sun JRE.
+                */
+               if (t instanceof NullPointerException) {
+                       StackTraceElement[] trace = t.getStackTrace();
+                       
+                       if (trace.length > 3 &&
+                                       trace[0].getClassName().equals("sun.awt.X11.XWindowPeer") &&
+                                       trace[0].getMethodName().equals("restoreTransientFor") &&
+
+                                       trace[1].getClassName().equals("sun.awt.X11.XWindowPeer") &&
+                                       trace[1].getMethodName().equals("removeFromTransientFors") &&
+
+                                       trace[2].getClassName().equals("sun.awt.X11.XWindowPeer") &&
+                                       trace[2].getMethodName().equals("setModalBlocked")) {
+                               log.warn("Ignoring Sun JRE bug (6826104): http://bugs.sun.com/view_bug.do?bug_id=6826104" + t);
+                               return true;
+                       }
+                       
+               }
+               
+
                /*
                 * Detect and ignore bug 6828938 in Sun JRE 1.6.0_14 - 1.6.0_16.
                 */