diff options
| author | 2015-02-10 22:23:12 -0500 | |
|---|---|---|
| committer | 2015-02-10 22:23:12 -0500 | |
| commit | c6a194dcf933dd7a4e2bf6b92bcb417957aba765 (patch) | |
| tree | c0a4b7ddfd87421b94e77bbcd9e607e67a2dc4f8 | |
| parent | add BRIDGE flag to bridge methods (diff) | |
| download | enigma-c6a194dcf933dd7a4e2bf6b92bcb417957aba765.tar.gz enigma-c6a194dcf933dd7a4e2bf6b92bcb417957aba765.tar.xz enigma-c6a194dcf933dd7a4e2bf6b92bcb417957aba765.zip | |
ignore harmless exceptions I can't fix
fyi, it's really hard to test this fix because the exception is not generally reproducable
| -rw-r--r-- | src/cuchaz/enigma/ExceptionIgnorer.java | 24 | ||||
| -rw-r--r-- | src/cuchaz/enigma/gui/Gui.java | 9 |
2 files changed, 30 insertions, 3 deletions
diff --git a/src/cuchaz/enigma/ExceptionIgnorer.java b/src/cuchaz/enigma/ExceptionIgnorer.java new file mode 100644 index 00000000..37c67da7 --- /dev/null +++ b/src/cuchaz/enigma/ExceptionIgnorer.java | |||
| @@ -0,0 +1,24 @@ | |||
| 1 | package cuchaz.enigma; | ||
| 2 | |||
| 3 | public class ExceptionIgnorer { | ||
| 4 | |||
| 5 | public static boolean shouldIgnore(Throwable t) { | ||
| 6 | |||
| 7 | // is this that pesky concurrent access bug in the highlight painter system? | ||
| 8 | // (ancient ui code is ancient) | ||
| 9 | if (t instanceof ArrayIndexOutOfBoundsException) { | ||
| 10 | StackTraceElement[] stackTrace = t.getStackTrace(); | ||
| 11 | if (stackTrace.length > 1) { | ||
| 12 | |||
| 13 | // does this stack frame match javax.swing.text.DefaultHighlighter.paint() ? | ||
| 14 | StackTraceElement frame = stackTrace[1]; | ||
| 15 | if (frame.getClassName().equals("javax.swing.text.DefaultHighlighter") && frame.getMethodName().equals("paint")) { | ||
| 16 | return true; | ||
| 17 | } | ||
| 18 | } | ||
| 19 | } | ||
| 20 | |||
| 21 | return false; | ||
| 22 | } | ||
| 23 | |||
| 24 | } | ||
diff --git a/src/cuchaz/enigma/gui/Gui.java b/src/cuchaz/enigma/gui/Gui.java index 187ef5b5..00cff595 100644 --- a/src/cuchaz/enigma/gui/Gui.java +++ b/src/cuchaz/enigma/gui/Gui.java | |||
| @@ -70,6 +70,7 @@ import jsyntaxpane.DefaultSyntaxKit; | |||
| 70 | import com.google.common.collect.Lists; | 70 | import com.google.common.collect.Lists; |
| 71 | 71 | ||
| 72 | import cuchaz.enigma.Constants; | 72 | import cuchaz.enigma.Constants; |
| 73 | import cuchaz.enigma.ExceptionIgnorer; | ||
| 73 | import cuchaz.enigma.analysis.BehaviorReferenceTreeNode; | 74 | import cuchaz.enigma.analysis.BehaviorReferenceTreeNode; |
| 74 | import cuchaz.enigma.analysis.ClassImplementationsTreeNode; | 75 | import cuchaz.enigma.analysis.ClassImplementationsTreeNode; |
| 75 | import cuchaz.enigma.analysis.ClassInheritanceTreeNode; | 76 | import cuchaz.enigma.analysis.ClassInheritanceTreeNode; |
| @@ -147,9 +148,11 @@ public class Gui { | |||
| 147 | CrashDialog.init(m_frame); | 148 | CrashDialog.init(m_frame); |
| 148 | Thread.setDefaultUncaughtExceptionHandler(new UncaughtExceptionHandler() { | 149 | Thread.setDefaultUncaughtExceptionHandler(new UncaughtExceptionHandler() { |
| 149 | @Override | 150 | @Override |
| 150 | public void uncaughtException(Thread thread, Throwable ex) { | 151 | public void uncaughtException(Thread thread, Throwable t) { |
| 151 | ex.printStackTrace(System.err); | 152 | t.printStackTrace(System.err); |
| 152 | CrashDialog.show(ex); | 153 | if (!ExceptionIgnorer.shouldIgnore(t)) { |
| 154 | CrashDialog.show(t); | ||
| 155 | } | ||
| 153 | } | 156 | } |
| 154 | }); | 157 | }); |
| 155 | } | 158 | } |