Konloch/bytecode-viewer · error · SecurityException

BCV is awesome, blocking System.exit(

Error message

BCV is awesome, blocking System.exit(

What it means

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.

Source

Thrown at src/main/java/the/bytecode/club/bytecodeviewer/util/SecurityMan.java:259

    }

    @Override
    public void checkCreateClassLoader()
    {
    }

    @Override
    public void checkDelete(String file)
    {
        if (printing)
            System.out.println("Deleting: " + file);
    }

    @Override
    public void checkExit(int status)
    {
        if (!Configuration.canExit)
            throw new SecurityException("BCV is awesome, blocking System.exit(" + status + ");");
    }

    @Override
    public void checkLink(String lib)
    {
        if (printing)
            System.out.println("Linking: " + lib);
    }

    @SuppressWarnings("deprecation")
    public void checkMemberAccess(Class<?> clazz, int which)
    {
    }

    @Override
    public void checkMulticast(InetAddress maddr)
    {
    }

View on GitHub (pinned to 31430e0033)

Solutions

  1. Remove/replace System.exit calls in the plugin or analyzed code with normal exception-based flow control
  2. Set Configuration.canExit = true only in a trusted context where VM shutdown is acceptable
  3. Catch the SecurityException at the boundary you control and translate it into an in-application error path
  4. Report the offending library behavior to its maintainers (calling exit from library code is bad practice)

Example fix

// before
System.exit(1); // throws SecurityException under BCV
// after
throw new RuntimeException("analysis failed"); // let BCV handle/report the failure
Defensive patterns

Strategy: try-catch

Validate before calling

if (!the.bytecode.club.bytecodeviewer.Configuration.canExit)
    throw new IllegalStateException("System.exit will be blocked under BCV");

Try / catch

try {
    System.exit(status);
} catch (SecurityException e) {
    if (e.getMessage().startsWith("BCV is awesome, blocking System.exit")) {
        // convert to exception-based failure handling instead
    } else throw e;
}

Prevention

When it happens

Trigger: 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().

Common situations: Analyzed libraries calling System.exit on failure; plugins using exit for flow control; embedded launchers that assume they own the JVM lifecycle.

Related errors


AI-assisted analysis of Konloch/bytecode-viewer@31430e0033 (2026-09-05). Data as JSON: /api/errors/6134fb799e24d0f4. Report an issue: GitHub.