From dfc8ae48ccb50e768c911ca71654afbd75585ce3 Mon Sep 17 00:00:00 2001 From: Jason Tedor Date: Tue, 27 Oct 2020 16:44:44 -0400 Subject: [PATCH] Fix using bundled JDK detection on macOS (#64236) This commit fixes an issue with the detection on macOS for whether or not the bundled JDK is being used. The logic between macOS and non-macOS is different because the JDK has a different directory structure on macOS versus non-macOS. However, due to notarization issues, we changed the top-level directory from jdk to jdk.app, yet never updated this detection logic to account for that. Ideally, we would have a packaging test that asserts that we have the behavior here correct, and it maintains over time. Alas, we do not currently have packaging tests on macOS. --- server/src/main/java/org/elasticsearch/monitor/jvm/JvmInfo.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/src/main/java/org/elasticsearch/monitor/jvm/JvmInfo.java b/server/src/main/java/org/elasticsearch/monitor/jvm/JvmInfo.java index c02e08f3a5e..4447b186110 100644 --- a/server/src/main/java/org/elasticsearch/monitor/jvm/JvmInfo.java +++ b/server/src/main/java/org/elasticsearch/monitor/jvm/JvmInfo.java @@ -178,7 +178,7 @@ public class JvmInfo implements ReportingService.Info { final String javaHome = System.getProperty("java.home"); final String userDir = System.getProperty("user.dir"); if (Constants.MAC_OS_X) { - return PathUtils.get(javaHome).equals(PathUtils.get(userDir).resolve("jdk/Contents/Home").toAbsolutePath()); + return PathUtils.get(javaHome).equals(PathUtils.get(userDir).resolve("jdk.app/Contents/Home").toAbsolutePath()); } else { return PathUtils.get(javaHome).equals(PathUtils.get(userDir).resolve("jdk").toAbsolutePath()); }