Ignore the NPE which happens when dropping a rocket component as the
last component in the previous child element. I can't seem to find a better solution than to just eat the npe.
This commit is contained in:
parent
c2d8314282
commit
cbb9a48435
@ -170,10 +170,10 @@ public class SwingExceptionHandler implements Thread.UncaughtExceptionHandler, E
|
|||||||
log.info("Showing out-of-memory dialog");
|
log.info("Showing out-of-memory dialog");
|
||||||
JOptionPane.showMessageDialog(null,
|
JOptionPane.showMessageDialog(null,
|
||||||
new Object[] {
|
new Object[] {
|
||||||
"OpenRocket is out of available memory!",
|
"OpenRocket is out of available memory!",
|
||||||
"You should immediately close unnecessary design windows,",
|
"You should immediately close unnecessary design windows,",
|
||||||
"save any unsaved designs and restart OpenRocket!"
|
"save any unsaved designs and restart OpenRocket!"
|
||||||
}, "Out of memory", JOptionPane.ERROR_MESSAGE);
|
}, "Out of memory", JOptionPane.ERROR_MESSAGE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,11 +188,11 @@ public class SwingExceptionHandler implements Thread.UncaughtExceptionHandler, E
|
|||||||
log.info("Showing Error dialog");
|
log.info("Showing Error dialog");
|
||||||
JOptionPane.showMessageDialog(null,
|
JOptionPane.showMessageDialog(null,
|
||||||
new Object[] {
|
new Object[] {
|
||||||
"An unknown Java error occurred:",
|
"An unknown Java error occurred:",
|
||||||
msg,
|
msg,
|
||||||
"<html>You should immediately close unnecessary design windows,<br>" +
|
"<html>You should immediately close unnecessary design windows,<br>" +
|
||||||
"save any unsaved designs and restart OpenRocket!"
|
"save any unsaved designs and restart OpenRocket!"
|
||||||
}, "Unknown Java error", JOptionPane.ERROR_MESSAGE);
|
}, "Unknown Java error", JOptionPane.ERROR_MESSAGE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -202,13 +202,13 @@ public class SwingExceptionHandler implements Thread.UncaughtExceptionHandler, E
|
|||||||
int selection = JOptionPane.showOptionDialog(null, new Object[] {
|
int selection = JOptionPane.showOptionDialog(null, new Object[] {
|
||||||
"OpenRocket encountered an uncaught exception. This typically signifies " +
|
"OpenRocket encountered an uncaught exception. This typically signifies " +
|
||||||
"a bug in the software.",
|
"a bug in the software.",
|
||||||
"<html><em> " + msg + "</em>",
|
"<html><em> " + msg + "</em>",
|
||||||
" ",
|
" ",
|
||||||
"Please take a moment to report this bug to the developers.",
|
"Please take a moment to report this bug to the developers.",
|
||||||
"This can be done automatically if you have an Internet connection."
|
"This can be done automatically if you have an Internet connection."
|
||||||
}, "Uncaught exception", JOptionPane.DEFAULT_OPTION,
|
}, "Uncaught exception", JOptionPane.DEFAULT_OPTION,
|
||||||
JOptionPane.ERROR_MESSAGE, null,
|
JOptionPane.ERROR_MESSAGE, null,
|
||||||
new Object[] { "View bug report", "Close" }, "View bug report");
|
new Object[] { "View bug report", "Close" }, "View bug report");
|
||||||
|
|
||||||
if (selection != 0) {
|
if (selection != 0) {
|
||||||
// User cancelled
|
// User cancelled
|
||||||
@ -326,7 +326,7 @@ public class SwingExceptionHandler implements Thread.UncaughtExceptionHandler, E
|
|||||||
if (elements.length >= 3 &&
|
if (elements.length >= 3 &&
|
||||||
(buggyClass.equals(elements[0].getClassName()) ||
|
(buggyClass.equals(elements[0].getClassName()) ||
|
||||||
buggyClass.equals(elements[1].getClassName()) ||
|
buggyClass.equals(elements[1].getClassName()) ||
|
||||||
buggyClass.equals(elements[2].getClassName()))) {
|
buggyClass.equals(elements[2].getClassName()))) {
|
||||||
log.warn("Ignoring Sun JRE bug 6828938: " +
|
log.warn("Ignoring Sun JRE bug 6828938: " +
|
||||||
"(see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6828938): " + t);
|
"(see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6828938): " + t);
|
||||||
return true;
|
return true;
|
||||||
@ -402,6 +402,24 @@ public class SwingExceptionHandler implements Thread.UncaughtExceptionHandler, E
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Detect and ignore DnD bug in component tree - related to 6560955 in Sun JRE.
|
||||||
|
*/
|
||||||
|
if (t instanceof NullPointerException) {
|
||||||
|
StackTraceElement[] trace = t.getStackTrace();
|
||||||
|
|
||||||
|
if (trace.length > 2 &&
|
||||||
|
trace[0].getClassName().equals("javax.swing.tree.TreePath") &&
|
||||||
|
trace[0].getMethodName().equals("pathByAddingChild") &&
|
||||||
|
|
||||||
|
trace[1].getClassName().equals("javax.swing.plaf.basic.BasicTreeUI") &&
|
||||||
|
trace[1].getMethodName().equals("getDropLineRect")) {
|
||||||
|
|
||||||
|
log.warn("Ignoring Sun JRE bug updating drop location " +
|
||||||
|
"(see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6560955): " + t);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user