From edd09c04096b50892943764517c46db11f8b5709 Mon Sep 17 00:00:00 2001 From: Konloch Date: Wed, 2 Oct 2024 19:12:50 -0600 Subject: [PATCH] JavaP Added Simulated Errors --- .../decompilers/impl/JavapDisassembler.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/impl/JavapDisassembler.java b/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/impl/JavapDisassembler.java index 1ad51b58..1b68a445 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/impl/JavapDisassembler.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/impl/JavapDisassembler.java @@ -22,6 +22,7 @@ import me.konloch.kontainer.io.DiskWriter; import org.objectweb.asm.tree.ClassNode; import the.bytecode.club.bytecodeviewer.BytecodeViewer; import the.bytecode.club.bytecodeviewer.Configuration; +import the.bytecode.club.bytecodeviewer.Constants; import the.bytecode.club.bytecodeviewer.api.ExceptionUI; import the.bytecode.club.bytecodeviewer.decompilers.AbstractDecompiler; import the.bytecode.club.bytecodeviewer.gui.components.JFrameConsolePrintStream; @@ -37,6 +38,7 @@ import java.net.URL; import java.net.URLClassLoader; import static the.bytecode.club.bytecodeviewer.Constants.NL; +import static the.bytecode.club.bytecodeviewer.translation.TranslatedStrings.DEV_MODE_SIMULATED_ERROR; import static the.bytecode.club.bytecodeviewer.translation.TranslatedStrings.ERROR; /** @@ -107,8 +109,14 @@ public class JavapDisassembler extends AbstractDecompiler //expected warning behaviour on JDK-15 } - //return output + //signal finished sysOutBuffer.finished(); + + //handle simulated errors + if(Constants.DEV_FLAG_DECOMPILERS_SIMULATED_ERRORS) + throw new RuntimeException(DEV_MODE_SIMULATED_ERROR.toString()); + + //return output return sysOutBuffer.getTextAreaOutputStreamOut().getBuffer().toString(); } catch (IllegalAccessException e)