{"record":{"id":"6134fb799e24d0f4","repo":"Konloch/bytecode-viewer","slug":"bcv-is-awesome-blocking-system-exit","errorCode":null,"errorMessage":"BCV is awesome, blocking System.exit(","messagePattern":"BCV is awesome, blocking System\\.exit\\(","errorType":"exception","errorClass":"SecurityException","httpStatus":null,"severity":"error","filePath":"src/main/java/the/bytecode/club/bytecodeviewer/util/SecurityMan.java","lineNumber":259,"sourceCode":"    }\n\n    @Override\n    public void checkCreateClassLoader()\n    {\n    }\n\n    @Override\n    public void checkDelete(String file)\n    {\n        if (printing)\n            System.out.println(\"Deleting: \" + file);\n    }\n\n    @Override\n    public void checkExit(int status)\n    {\n        if (!Configuration.canExit)\n            throw new SecurityException(\"BCV is awesome, blocking System.exit(\" + status + \");\");\n    }\n\n    @Override\n    public void checkLink(String lib)\n    {\n        if (printing)\n            System.out.println(\"Linking: \" + lib);\n    }\n\n    @SuppressWarnings(\"deprecation\")\n    public void checkMemberAccess(Class<?> clazz, int which)\n    {\n    }\n\n    @Override\n    public void checkMulticast(InetAddress maddr)\n    {\n    }","sourceCodeStart":241,"sourceCodeEnd":277,"githubUrl":"https://github.com/Konloch/bytecode-viewer/blob/31430e0033fa220db566b5ef461256727ff6793b/src/main/java/the/bytecode/club/bytecodeviewer/util/SecurityMan.java#L241-L277","documentation":"SecurityMan.checkExit throws SecurityException when System.exit (or Runtime.exit/halt) is called while Configuration.canExit is false. BCV blocks exit calls so plugin or analyzed code cannot terminate the whole viewer. The message includes the requested exit status.","triggerScenarios":"Any code running under BCV's SecurityManager calls System.exit(status) while Configuration.canExit is false — typically plugin or analyzed code error-handling with exit().","commonSituations":"Analyzed libraries calling System.exit on failure; plugins using exit for flow control; embedded launchers that assume they own the JVM lifecycle.","solutions":["Remove/replace System.exit calls in the plugin or analyzed code with normal exception-based flow control","Set Configuration.canExit = true only in a trusted context where VM shutdown is acceptable","Catch the SecurityException at the boundary you control and translate it into an in-application error path","Report the offending library behavior to its maintainers (calling exit from library code is bad practice)"],"exampleFix":"// before\nSystem.exit(1); // throws SecurityException under BCV\n// after\nthrow new RuntimeException(\"analysis failed\"); // let BCV handle/report the failure","handlingStrategy":"try-catch","validationCode":"if (!the.bytecode.club.bytecodeviewer.Configuration.canExit)\n    throw new IllegalStateException(\"System.exit will be blocked under BCV\");","typeGuard":null,"tryCatchPattern":"try {\n    System.exit(status);\n} catch (SecurityException e) {\n    if (e.getMessage().startsWith(\"BCV is awesome, blocking System.exit\")) {\n        // convert to exception-based failure handling instead\n    } else throw e;\n}","preventionTips":["Never call System.exit from plugin or library code","Use exceptions/return codes for control flow","Only set Configuration.canExit=true in trusted, controlled runs","Audit third-party libraries used in plugins for exit() calls"],"tags":["java","security","securitymanager","system-exit","sandbox"],"backgroundTag":"exit-blocked-by-securitymanager","analyzedSha":"31430e0033fa220db566b5ef461256727ff6793b","analyzedAt":"2026-09-05T18:22:22.725Z","contentChangedAt":"2026-09-05T18:22:22.725Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}