[FIX] Остатки после удаления агента.

This commit is contained in:
zaxar163 2019-11-10 10:21:44 +03:00
parent 3291d2de6b
commit b23b033d19
2 changed files with 5 additions and 0 deletions

View file

@ -54,6 +54,7 @@ public static void main(String... args) throws Throwable {
JVMHelper.verifySystemProperties(Launcher.class, true); JVMHelper.verifySystemProperties(Launcher.class, true);
EnvHelper.checkDangerousParams(); EnvHelper.checkDangerousParams();
//if(!LauncherAgent.isStarted()) throw new SecurityException("JavaAgent not set"); //if(!LauncherAgent.isStarted()) throw new SecurityException("JavaAgent not set");
JVMHelper.verifyNoAgent();
LogHelper.printVersion("Launcher"); LogHelper.printVersion("Launcher");
LogHelper.printLicense("Launcher"); LogHelper.printLicense("Launcher");
LauncherEngine.checkClass(LauncherEngine.class); LauncherEngine.checkClass(LauncherEngine.class);

View file

@ -180,4 +180,8 @@ public static void verifySystemProperties(Class<?> mainClass, boolean requireSys
private JVMHelper() { private JVMHelper() {
} }
public static void verifyNoAgent() {
if (RUNTIME_MXBEAN.getInputArguments().stream().filter(e -> e != null && !e.isEmpty()).anyMatch(e -> e.contains("javaagent"))) throw new SecurityException("JavaAgent found");
}
} }