Skip to content

Commit edd09c0

Browse files
committed
JavaP Added Simulated Errors
1 parent e029c73 commit edd09c0

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/main/java/the/bytecode/club/bytecodeviewer/decompilers/impl/JavapDisassembler.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
import org.objectweb.asm.tree.ClassNode;
2323
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
2424
import the.bytecode.club.bytecodeviewer.Configuration;
25+
import the.bytecode.club.bytecodeviewer.Constants;
2526
import the.bytecode.club.bytecodeviewer.api.ExceptionUI;
2627
import the.bytecode.club.bytecodeviewer.decompilers.AbstractDecompiler;
2728
import the.bytecode.club.bytecodeviewer.gui.components.JFrameConsolePrintStream;
@@ -37,6 +38,7 @@
3738
import java.net.URLClassLoader;
3839

3940
import static the.bytecode.club.bytecodeviewer.Constants.NL;
41+
import static the.bytecode.club.bytecodeviewer.translation.TranslatedStrings.DEV_MODE_SIMULATED_ERROR;
4042
import static the.bytecode.club.bytecodeviewer.translation.TranslatedStrings.ERROR;
4143

4244
/**
@@ -107,8 +109,14 @@ private synchronized String disassembleJavaP(ClassNode cn, byte[] bytes)
107109
//expected warning behaviour on JDK-15
108110
}
109111

110-
//return output
112+
//signal finished
111113
sysOutBuffer.finished();
114+
115+
//handle simulated errors
116+
if(Constants.DEV_FLAG_DECOMPILERS_SIMULATED_ERRORS)
117+
throw new RuntimeException(DEV_MODE_SIMULATED_ERROR.toString());
118+
119+
//return output
112120
return sysOutBuffer.getTextAreaOutputStreamOut().getBuffer().toString();
113121
}
114122
catch (IllegalAccessException e)

0 commit comments

Comments
 (0)