// Intercept Runtime.getRuntime().halt, and check if the caller is allowed to use it, if not // wrap it in a ExitTrappedException public static void runtimeHaltCalled(Runtime runtime, int status) { ExitVisitor.checkAccess(); runtime.halt(status); }
// Intercept System.exit, and check if the caller is allowed to use it, if not wrap it in a // ExitTrappedException public static void systemExitCalled(int status) { ExitVisitor.checkAccess(); System.exit(status); }