|
@@ -82,7 +82,7 @@ public abstract class AbstractLocalClusterFactory<S extends LocalClusterSpec, H
|
|
|
private static final String ENABLE_DEBUG_JVM_ARGS = "-agentlib:jdwp=transport=dt_socket,server=n,suspend=y,address=";
|
|
|
private static final String ENTITLEMENT_POLICY_YAML = "entitlement-policy.yaml";
|
|
|
private static final String PLUGIN_DESCRIPTOR_PROPERTIES = "plugin-descriptor.properties";
|
|
|
- public static final String DISTRO_WITH_JDK_LOWER_21 = "8.11.0";
|
|
|
+ public static final String FIRST_DISTRO_WITH_JDK_21 = "8.11.0";
|
|
|
|
|
|
private final DistributionResolver distributionResolver;
|
|
|
|
|
@@ -869,7 +869,7 @@ public abstract class AbstractLocalClusterFactory<S extends LocalClusterSpec, H
|
|
|
private Map<String, String> getEnvironmentVariables() {
|
|
|
Map<String, String> environment = new HashMap<>(spec.resolveEnvironment());
|
|
|
String esFallbackJavaHome = System.getenv("ES_FALLBACK_JAVA_HOME");
|
|
|
- if (spec.getVersion().before(DISTRO_WITH_JDK_LOWER_21) && esFallbackJavaHome != null && esFallbackJavaHome.isEmpty() == false) {
|
|
|
+ if (jdkIsIncompatible(spec.getVersion()) && esFallbackJavaHome != null && esFallbackJavaHome.isEmpty() == false) {
|
|
|
environment.put("ES_JAVA_HOME", esFallbackJavaHome);
|
|
|
}
|
|
|
environment.put("ES_PATH_CONF", configDir.toString());
|
|
@@ -922,6 +922,10 @@ public abstract class AbstractLocalClusterFactory<S extends LocalClusterSpec, H
|
|
|
return environment;
|
|
|
}
|
|
|
|
|
|
+ private boolean jdkIsIncompatible(Version version) {
|
|
|
+ return version.after("0.0.0") && version.before(FIRST_DISTRO_WITH_JDK_21);
|
|
|
+ }
|
|
|
+
|
|
|
private record ReplacementKey(String key, String fallback) {
|
|
|
ReplacementKey {
|
|
|
assert fallback == null || fallback.isEmpty() == false; // no empty fallback, which would match anything
|