From c6a194dcf933dd7a4e2bf6b92bcb417957aba765 Mon Sep 17 00:00:00 2001 From: jeff Date: Tue, 10 Feb 2015 22:23:12 -0500 Subject: ignore harmless exceptions I can't fix fyi, it's really hard to test this fix because the exception is not generally reproducable --- src/cuchaz/enigma/ExceptionIgnorer.java | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/cuchaz/enigma/ExceptionIgnorer.java (limited to 'src/cuchaz/enigma/ExceptionIgnorer.java') 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 @@ +package cuchaz.enigma; + +public class ExceptionIgnorer { + + public static boolean shouldIgnore(Throwable t) { + + // is this that pesky concurrent access bug in the highlight painter system? + // (ancient ui code is ancient) + if (t instanceof ArrayIndexOutOfBoundsException) { + StackTraceElement[] stackTrace = t.getStackTrace(); + if (stackTrace.length > 1) { + + // does this stack frame match javax.swing.text.DefaultHighlighter.paint() ? + StackTraceElement frame = stackTrace[1]; + if (frame.getClassName().equals("javax.swing.text.DefaultHighlighter") && frame.getMethodName().equals("paint")) { + return true; + } + } + } + + return false; + } + +} -- cgit v1.2.3