From 7dd66d675cdf9ea134d6456686c62d79f0856bb2 Mon Sep 17 00:00:00 2001 From: Konloch Date: Tue, 29 Jun 2021 11:24:47 -0700 Subject: [PATCH] Silence Exceptions --- .../club/bytecodeviewer/Configuration.java | 2 ++ .../club/bytecodeviewer/api/ExceptionUI.java | 18 +++++++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/Configuration.java b/src/main/java/the/bytecode/club/bytecodeviewer/Configuration.java index 85dbb4b3..85c0fb1f 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/Configuration.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/Configuration.java @@ -33,6 +33,8 @@ public class Configuration public static boolean pingback = false; public static boolean deleteForeignLibraries = true; public static boolean canExit = false; + public static int silenceExceptionGUI = 0; + public static int pauseExceptionGUI = 0; public static boolean verifyCorruptedStateOnBoot = false; //eventually may be a setting diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/api/ExceptionUI.java b/src/main/java/the/bytecode/club/bytecodeviewer/api/ExceptionUI.java index ba1bd772..f61384be 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/api/ExceptionUI.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/api/ExceptionUI.java @@ -8,7 +8,8 @@ import java.io.StringWriter; import javax.swing.JFrame; import javax.swing.JScrollPane; import javax.swing.JTextArea; -import the.bytecode.club.bytecodeviewer.BytecodeViewer; + +import the.bytecode.club.bytecodeviewer.Configuration; import the.bytecode.club.bytecodeviewer.Resources; import static the.bytecode.club.bytecodeviewer.Constants.*; @@ -71,8 +72,19 @@ public class ExceptionUI extends JFrame { setup(e, author); } - private void setup(Throwable e, String author) { - + private void setup(Throwable e, String author) + { + //exceptions are completely hidden + if(Configuration.silenceExceptionGUI > 0) + return; + + //exception GUI is disabled but printstack is still enabled + if(Configuration.pauseExceptionGUI > 0) + { + e.printStackTrace(); + return; + } + this.setIconImages(Resources.iconList); setSize(new Dimension(600, 400)); setTitle("Bytecode Viewer " + VERSION + " - Stack Trace - Send this to " + author);