diff options
Diffstat (limited to 'src/cuchaz/enigma/ExceptionIgnorer.java')
| -rw-r--r-- | src/cuchaz/enigma/ExceptionIgnorer.java | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/cuchaz/enigma/ExceptionIgnorer.java b/src/cuchaz/enigma/ExceptionIgnorer.java new file mode 100644 index 0000000..37c67da --- /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 | } | ||