]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-14960 Fix Elasticsearch deprecation warning for JAVA_HOME
authorJacek <jacek.poreda@sonarsource.com>
Thu, 17 Jun 2021 11:53:05 +0000 (13:53 +0200)
committersonartech <sonartech@sonarsource.com>
Thu, 16 Dec 2021 20:03:10 +0000 (20:03 +0000)
(cherry picked from commit 6ac2ee09fc8b60b3d90e900dbff25820ad8361a6)

server/sonar-main/src/main/java/org/sonar/application/command/CommandFactoryImpl.java
server/sonar-main/src/test/java/org/sonar/application/command/CommandFactoryImplTest.java

index 9bd07d512e6a350dccbc318879f5cbc4b7fc6189..ca48e8fba69a29d4ae433afc5193cbcaac5dca6d 100644 (file)
@@ -111,7 +111,7 @@ public class CommandFactoryImpl implements CommandFactory {
       .setEsInstallation(esInstallation)
       .setEnvVariable("ES_PATH_CONF", esInstallation.getConfDirectory().getAbsolutePath())
       .setEnvVariable("ES_JVM_OPTIONS", esInstallation.getJvmOptions().getAbsolutePath())
-      .setEnvVariable("JAVA_HOME", System.getProperties().getProperty("java.home"))
+      .setEnvVariable("ES_JAVA_HOME", System.getProperties().getProperty("java.home"))
       .suppressEnvVariable(ENV_VAR_JAVA_TOOL_OPTIONS)
       .suppressEnvVariable(ENV_VAR_ES_JAVA_OPTS);
   }
@@ -126,7 +126,7 @@ public class CommandFactoryImpl implements CommandFactory {
         .add("-Des.path.home=" + esInstallation.getHomeDirectory().getAbsolutePath())
         .add("-Des.path.conf=" + esInstallation.getConfDirectory().getAbsolutePath()))
       .setEnvVariable("ES_JVM_OPTIONS", esInstallation.getJvmOptions().getAbsolutePath())
-      .setEnvVariable("JAVA_HOME", System.getProperties().getProperty("java.home"))
+      .setEnvVariable("ES_JAVA_HOME", System.getProperties().getProperty("java.home"))
       .setClassName("org.elasticsearch.bootstrap.Elasticsearch")
       .addClasspath("lib/*")
       .suppressEnvVariable(ENV_VAR_JAVA_TOOL_OPTIONS)
index f8d7029008a71e77f55accaa67eab0d000ca4713..e8318bc1b5f8a5869cfe2fedd4440626375be810 100644 (file)
@@ -146,7 +146,7 @@ public class CommandFactoryImplTest {
     assertThat(esCommand.getEnvVariables())
       .contains(entry("ES_PATH_CONF", esConfDir.getAbsolutePath()))
       .contains(entry("ES_JVM_OPTIONS", new File(esConfDir, "jvm.options").getAbsolutePath()))
-      .containsKey("JAVA_HOME");
+      .containsKey("ES_JAVA_HOME");
     assertThat(esCommand.getSuppressedEnvVariables()).containsOnly("JAVA_TOOL_OPTIONS", "ES_JAVA_OPTS");
 
     assertThat(esConfig.getEsJvmOptions().getAll())
@@ -182,7 +182,7 @@ public class CommandFactoryImplTest {
     assertThat(esCommand.getArguments()).isEmpty();
     assertThat(esCommand.getEnvVariables())
       .contains(entry("ES_JVM_OPTIONS", new File(esConfDir, "jvm.options").getAbsolutePath()))
-      .containsKey("JAVA_HOME");
+      .containsKey("ES_JAVA_HOME");
     assertThat(esCommand.getSuppressedEnvVariables()).containsOnly("JAVA_TOOL_OPTIONS", "ES_JAVA_OPTS");
 
     assertThat(esConfig.getEsJvmOptions().getAll())