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.
This commit is contained in:
Jason Tedor 2020-10-27 16:44:44 -04:00
parent b46b6d5977
commit dfc8ae48cc
No known key found for this signature in database
GPG Key ID: FA89F05560F16BC5
1 changed files with 1 additions and 1 deletions

View File

@ -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());
}