diff options
author | Duarte Meneses <duarte.meneses@sonarsource.com> | 2020-04-13 09:13:40 -0500 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2020-04-17 20:03:43 +0000 |
commit | e014a2b976e733f33f369b868dbdf475b06650fe (patch) | |
tree | e4e34e9efcbd2efa9e47d8e2e0fcc8baabfe5794 /server/sonar-main | |
parent | 6cd0dc9e3241aa6bc97e2ae4f20d01e4bbd8ae56 (diff) | |
download | sonarqube-e014a2b976e733f33f369b868dbdf475b06650fe.tar.gz sonarqube-e014a2b976e733f33f369b868dbdf475b06650fe.zip |
SONAR-13037 Stacktrace should always be available in logs
Diffstat (limited to 'server/sonar-main')
5 files changed, 7 insertions, 5 deletions
diff --git a/server/sonar-main/src/main/java/org/sonar/application/command/CeJvmOptions.java b/server/sonar-main/src/main/java/org/sonar/application/command/CeJvmOptions.java index 920ca17b23b..4ddef8994a8 100644 --- a/server/sonar-main/src/main/java/org/sonar/application/command/CeJvmOptions.java +++ b/server/sonar-main/src/main/java/org/sonar/application/command/CeJvmOptions.java @@ -34,6 +34,7 @@ public class CeJvmOptions extends JvmOptions<CeJvmOptions> { res.put("-Djava.awt.headless=", "true"); res.put("-Dfile.encoding=", "UTF-8"); res.put("-Djava.io.tmpdir=", tmpDir.getAbsolutePath()); + res.put("-XX:-OmitStackTraceInFastThrow", ""); if (javaVersion.isAtLeastJava11()) { // avoid illegal reflective access operations done by MyBatis diff --git a/server/sonar-main/src/main/java/org/sonar/application/command/CommandFactoryImpl.java b/server/sonar-main/src/main/java/org/sonar/application/command/CommandFactoryImpl.java index 2ad11760b3d..66c2f02672d 100644 --- a/server/sonar-main/src/main/java/org/sonar/application/command/CommandFactoryImpl.java +++ b/server/sonar-main/src/main/java/org/sonar/application/command/CommandFactoryImpl.java @@ -145,7 +145,7 @@ public class CommandFactoryImpl implements CommandFactory { .setEsYmlSettings(new EsYmlSettings(settingsMap)) .setClusterName(settingsMap.get("cluster.name")) .setHost(settingsMap.get("network.host")) - .setPort(Integer.valueOf(settingsMap.get("transport.tcp.port"))); + .setPort(Integer.parseInt(settingsMap.get("transport.tcp.port"))); return esInstallation; } diff --git a/server/sonar-main/src/main/java/org/sonar/application/command/WebJvmOptions.java b/server/sonar-main/src/main/java/org/sonar/application/command/WebJvmOptions.java index 1230fba5eea..8815e0c2c96 100644 --- a/server/sonar-main/src/main/java/org/sonar/application/command/WebJvmOptions.java +++ b/server/sonar-main/src/main/java/org/sonar/application/command/WebJvmOptions.java @@ -33,6 +33,7 @@ public class WebJvmOptions extends JvmOptions<WebJvmOptions> { res.put("-Djava.awt.headless=", "true"); res.put("-Dfile.encoding=", "UTF-8"); res.put("-Djava.io.tmpdir=", tmpDir.getAbsolutePath()); + res.put("-XX:-OmitStackTraceInFastThrow", ""); if (javaVersion.isAtLeastJava11()) { // avoid illegal reflective access operations done by MyBatis diff --git a/server/sonar-main/src/test/java/org/sonar/application/command/CeJvmOptionsTest.java b/server/sonar-main/src/test/java/org/sonar/application/command/CeJvmOptionsTest.java index 50e286ea651..971e1f7f645 100644 --- a/server/sonar-main/src/test/java/org/sonar/application/command/CeJvmOptionsTest.java +++ b/server/sonar-main/src/test/java/org/sonar/application/command/CeJvmOptionsTest.java @@ -48,7 +48,7 @@ public class CeJvmOptionsTest { when(javaVersion.isAtLeastJava11()).thenReturn(false); underTest = new CeJvmOptions(tmpDir, javaVersion); assertThat(underTest.getAll()).containsExactly( - "-Djava.awt.headless=true", "-Dfile.encoding=UTF-8", "-Djava.io.tmpdir=" + tmpDir.getAbsolutePath()); + "-Djava.awt.headless=true", "-Dfile.encoding=UTF-8", "-Djava.io.tmpdir=" + tmpDir.getAbsolutePath(), "-XX:-OmitStackTraceInFastThrow"); } @Test @@ -56,7 +56,7 @@ public class CeJvmOptionsTest { when(javaVersion.isAtLeastJava11()).thenReturn(true); underTest = new CeJvmOptions(tmpDir, javaVersion); assertThat(underTest.getAll()).containsExactly( - "-Djava.awt.headless=true", "-Dfile.encoding=UTF-8", "-Djava.io.tmpdir=" + tmpDir.getAbsolutePath(), + "-Djava.awt.headless=true", "-Dfile.encoding=UTF-8", "-Djava.io.tmpdir=" + tmpDir.getAbsolutePath(), "-XX:-OmitStackTraceInFastThrow", "--add-opens=java.base/java.util=ALL-UNNAMED"); } } diff --git a/server/sonar-main/src/test/java/org/sonar/application/command/WebJvmOptionsTest.java b/server/sonar-main/src/test/java/org/sonar/application/command/WebJvmOptionsTest.java index 567bdd8a396..900cfc71007 100644 --- a/server/sonar-main/src/test/java/org/sonar/application/command/WebJvmOptionsTest.java +++ b/server/sonar-main/src/test/java/org/sonar/application/command/WebJvmOptionsTest.java @@ -48,7 +48,7 @@ public class WebJvmOptionsTest { when(javaVersion.isAtLeastJava11()).thenReturn(false); underTest = new WebJvmOptions(tmpDir, javaVersion); assertThat(underTest.getAll()).containsExactly( - "-Djava.awt.headless=true", "-Dfile.encoding=UTF-8", "-Djava.io.tmpdir=" + tmpDir.getAbsolutePath()); + "-Djava.awt.headless=true", "-Dfile.encoding=UTF-8", "-Djava.io.tmpdir=" + tmpDir.getAbsolutePath(), "-XX:-OmitStackTraceInFastThrow"); } @Test @@ -57,7 +57,7 @@ public class WebJvmOptionsTest { underTest = new WebJvmOptions(tmpDir, javaVersion); assertThat(underTest.getAll()).containsExactly( - "-Djava.awt.headless=true", "-Dfile.encoding=UTF-8", "-Djava.io.tmpdir=" + tmpDir.getAbsolutePath(), + "-Djava.awt.headless=true", "-Dfile.encoding=UTF-8", "-Djava.io.tmpdir=" + tmpDir.getAbsolutePath(), "-XX:-OmitStackTraceInFastThrow", "--add-opens=java.base/java.util=ALL-UNNAMED", "--add-opens=java.base/java.lang=ALL-UNNAMED", "--add-opens=java.base/java.io=ALL-UNNAMED", |