[FIX] Агент на VM отличных от HotSpot.

This commit is contained in:
Zaxar163 2019-06-11 11:41:22 +03:00
parent 084b84a6a2
commit abc990bded

View file

@ -10,6 +10,7 @@
import java.lang.management.ManagementFactory;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.jar.JarFile;
import org.objectweb.asm.ClassReader;
@ -54,13 +55,14 @@ public static void premain(String agentArgument, Instrumentation instrumentation
if (trimmedArg.contains("r")) rt = false;
}
}
try {
if (ManagementFactory.getOperatingSystemMXBean().getName().startsWith("Windows")) replaceClasses(pb, rt);
else replaceClasses(false, false);
} catch (Error e) {
NativeJVMHalt.haltA(294);
throw e;
}
if (System.getProperty("java.vm.name").toUpperCase(Locale.US).indexOf("HOTSPOT") != -1)
try {
if (ManagementFactory.getOperatingSystemMXBean().getName().startsWith("Windows")) replaceClasses(pb, rt);
else replaceClasses(false, false);
} catch (Error e) {
NativeJVMHalt.haltA(294);
throw e;
}
}
public static boolean isStarted() {