diff options
Diffstat (limited to 'src/cuchaz/enigma/ExceptionIgnorer.java')
| -rw-r--r-- | src/cuchaz/enigma/ExceptionIgnorer.java | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/cuchaz/enigma/ExceptionIgnorer.java b/src/cuchaz/enigma/ExceptionIgnorer.java new file mode 100644 index 0000000..d8726d1 --- /dev/null +++ b/src/cuchaz/enigma/ExceptionIgnorer.java | |||
| @@ -0,0 +1,34 @@ | |||
| 1 | /******************************************************************************* | ||
| 2 | * Copyright (c) 2015 Jeff Martin. | ||
| 3 | * All rights reserved. This program and the accompanying materials | ||
| 4 | * are made available under the terms of the GNU Lesser General Public | ||
| 5 | * License v3.0 which accompanies this distribution, and is available at | ||
| 6 | * http://www.gnu.org/licenses/lgpl.html | ||
| 7 | * | ||
| 8 | * Contributors: | ||
| 9 | * Jeff Martin - initial API and implementation | ||
| 10 | ******************************************************************************/ | ||
| 11 | package cuchaz.enigma; | ||
| 12 | |||
| 13 | public class ExceptionIgnorer { | ||
| 14 | |||
| 15 | public static boolean shouldIgnore(Throwable t) { | ||
| 16 | |||
| 17 | // is this that pesky concurrent access bug in the highlight painter system? | ||
| 18 | // (ancient ui code is ancient) | ||
| 19 | if (t instanceof ArrayIndexOutOfBoundsException) { | ||
| 20 | StackTraceElement[] stackTrace = t.getStackTrace(); | ||
| 21 | if (stackTrace.length > 1) { | ||
| 22 | |||
| 23 | // does this stack frame match javax.swing.text.DefaultHighlighter.paint*() ? | ||
| 24 | StackTraceElement frame = stackTrace[1]; | ||
| 25 | if (frame.getClassName().equals("javax.swing.text.DefaultHighlighter") && frame.getMethodName().startsWith("paint")) { | ||
| 26 | return true; | ||
| 27 | } | ||
| 28 | } | ||
| 29 | } | ||
| 30 | |||
| 31 | return false; | ||
| 32 | } | ||
| 33 | |||
| 34 | } | ||