Add generic is-before-java9 check

This commit is contained in:
Nikolay Martynov 2019-11-05 13:02:18 -05:00
parent b31778a05e
commit 415a875dfc
1 changed files with 5 additions and 2 deletions

View File

@ -268,8 +268,7 @@ public class TracingAgent {
private static ClassLoader createDatadogClassLoader(
final String innerJarFilename, final URL bootstrapURL) throws Exception {
final ClassLoader agentParent;
final String javaVersion = System.getProperty("java.version");
if (javaVersion.startsWith("1.7") || javaVersion.startsWith("1.8")) {
if (isJavaBefore9()) {
agentParent = null; // bootstrap
} else {
// platform classloader is parent of system in java 9+
@ -375,6 +374,10 @@ public class TracingAgent {
return false;
}
private static boolean isJavaBefore9() {
return System.getProperty("java.version").startsWith("1.");
}
/**
* Main entry point.
*