From fc2da15bcee9560186058b3e2fd12ddcb0eb0f39 Mon Sep 17 00:00:00 2001 From: Per Minborg Date: Tue, 26 Nov 2024 12:07:26 +0000 Subject: [PATCH] 8344419: Use StaticProperty in some JDK classes Reviewed-by: alanb, rriggs --- src/java.base/share/classes/jdk/internal/misc/CDS.java | 3 ++- .../share/classes/sun/security/util/DomainName.java | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/java.base/share/classes/jdk/internal/misc/CDS.java b/src/java.base/share/classes/jdk/internal/misc/CDS.java index ddb25cb7904..8661a2b3ff2 100644 --- a/src/java.base/share/classes/jdk/internal/misc/CDS.java +++ b/src/java.base/share/classes/jdk/internal/misc/CDS.java @@ -39,6 +39,7 @@ import java.util.Objects; import java.util.stream.Stream; import jdk.internal.access.SharedSecrets; +import jdk.internal.util.StaticProperty; public class CDS { // Must be in sync with cdsConfig.hpp @@ -275,7 +276,7 @@ public class CDS { listFile.delete(); } dumpClassList(listFileName); - String jdkHome = System.getProperty("java.home"); + String jdkHome = StaticProperty.javaHome(); String classPath = System.getProperty("java.class.path"); List cmds = new ArrayList(); cmds.add(jdkHome + File.separator + "bin" + File.separator + "java"); // java diff --git a/src/java.base/share/classes/sun/security/util/DomainName.java b/src/java.base/share/classes/sun/security/util/DomainName.java index 8be55036b58..5182ad1b5ca 100644 --- a/src/java.base/share/classes/sun/security/util/DomainName.java +++ b/src/java.base/share/classes/sun/security/util/DomainName.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -47,6 +47,7 @@ import java.util.zip.ZipInputStream; import static java.nio.charset.StandardCharsets.UTF_8; +import jdk.internal.util.StaticProperty; import sun.security.ssl.SSLLogger; /** @@ -209,7 +210,7 @@ class DomainName { new PrivilegedAction<>() { @Override public InputStream run() { - File f = new File(System.getProperty("java.home"), + File f = new File(StaticProperty.javaHome(), "lib/security/public_suffix_list.dat"); try { return new FileInputStream(f);