Skip to content

Commit 20e9413

Browse files
committedJan 18, 2025
Merge hermetic-java-runtime branch with JDK mainline up to openjdk/jdk@1ca7644.
1 parent 6d19c4a commit 20e9413

File tree

8 files changed

+40
-56
lines changed

8 files changed

+40
-56
lines changed
 

‎src/hotspot/share/prims/jvmtiAgent.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,7 @@ extern "C" {
320320
}
321321

322322
// Find the OnLoad entry point for -agentlib: -agentpath: -Xrun agents.
323-
static OnLoadEntry_t lookup_On_Load_entry_point(JvmtiAgent* agent, const char* on_load_symbol, bool ignore_errors) {) {
323+
static OnLoadEntry_t lookup_On_Load_entry_point(JvmtiAgent* agent, const char* on_load_symbol, bool ignore_errors) {
324324
assert(agent != nullptr, "invariant");
325325
if (!agent->is_loaded()) {
326326
if (!load_agent_from_executable(agent, on_load_symbol)) {

‎src/hotspot/share/utilities/zipLibrary.cpp

+11-20
Original file line numberDiff line numberDiff line change
@@ -74,27 +74,18 @@ static void* dll_lookup(const char* name, const char* path, bool vm_exit_on_fail
7474
return func;
7575
}
7676

77-
static void store_function_pointers(bool is_static, const char* path, bool vm_exit_on_failure) {
77+
static void store_function_pointers(const char* path, bool vm_exit_on_failure) {
7878
assert(_zip_handle != nullptr, "invariant");
79-
if (!is_static) {
80-
ZIP_Open = CAST_TO_FN_PTR(ZIP_Open_t, dll_lookup("ZIP_Open", path, vm_exit_on_failure));
81-
ZIP_Close = CAST_TO_FN_PTR(ZIP_Close_t, dll_lookup("ZIP_Close", path, vm_exit_on_failure));
82-
ZIP_FindEntry = CAST_TO_FN_PTR(ZIP_FindEntry_t, dll_lookup("ZIP_FindEntry", path, vm_exit_on_failure));
83-
ZIP_ReadEntry = CAST_TO_FN_PTR(ZIP_ReadEntry_t, dll_lookup("ZIP_ReadEntry", path, vm_exit_on_failure));
84-
ZIP_CRC32 = CAST_TO_FN_PTR(ZIP_CRC32_t, dll_lookup("ZIP_CRC32", path, vm_exit_on_failure));
85-
// The following entry points are most likely optional from a zip library implementation perspective.
86-
// Hence no vm_exit on a resolution failure. Further refactorings should investigate this,
87-
// and if possible, streamline setting all entry points consistently.
88-
ZIP_GZip_InitParams = CAST_TO_FN_PTR(ZIP_GZip_InitParams_t, dll_lookup("ZIP_GZip_InitParams", path, false));
89-
ZIP_GZip_Fully = CAST_TO_FN_PTR(ZIP_GZip_Fully_t, dll_lookup("ZIP_GZip_Fully", path, false));
90-
} else {
91-
ZIP_Open = CAST_TO_FN_PTR(ZIP_Open_t, os::lookup_function("ZIP_Open"));
92-
ZIP_Close = CAST_TO_FN_PTR(ZIP_Close_t, os::lookup_function("ZIP_Close"));
93-
ZIP_FindEntry = CAST_TO_FN_PTR(ZIP_FindEntry_t, os::lookup_function("ZIP_FindEntry"));
94-
ZIP_ReadEntry = CAST_TO_FN_PTR(ZIP_ReadEntry_t, os::lookup_function("ZIP_ReadEntry"));
95-
ZIP_CRC32 = CAST_TO_FN_PTR(ZIP_CRC32_t, os::lookup_function("ZIP_CRC32"));
96-
ZIP_GZip_InitParams = CAST_TO_FN_PTR(ZIP_GZip_InitParams_t, os::lookup_function("ZIP_GZip_InitParams")); ZIP_GZip_Fully = CAST_TO_FN_PTR(ZIP_GZip_Fully_t, os::lookup_function("ZIP_GZip_Fully"));
97-
}
79+
ZIP_Open = CAST_TO_FN_PTR(ZIP_Open_t, dll_lookup("ZIP_Open", path, vm_exit_on_failure));
80+
ZIP_Close = CAST_TO_FN_PTR(ZIP_Close_t, dll_lookup("ZIP_Close", path, vm_exit_on_failure));
81+
ZIP_FindEntry = CAST_TO_FN_PTR(ZIP_FindEntry_t, dll_lookup("ZIP_FindEntry", path, vm_exit_on_failure));
82+
ZIP_ReadEntry = CAST_TO_FN_PTR(ZIP_ReadEntry_t, dll_lookup("ZIP_ReadEntry", path, vm_exit_on_failure));
83+
ZIP_CRC32 = CAST_TO_FN_PTR(ZIP_CRC32_t, dll_lookup("ZIP_CRC32", path, vm_exit_on_failure));
84+
// The following entry points are most likely optional from a zip library implementation perspective.
85+
// Hence no vm_exit on a resolution failure. Further refactorings should investigate this,
86+
// and if possible, streamline setting all entry points consistently.
87+
ZIP_GZip_InitParams = CAST_TO_FN_PTR(ZIP_GZip_InitParams_t, dll_lookup("ZIP_GZip_InitParams", path, false));
88+
ZIP_GZip_Fully = CAST_TO_FN_PTR(ZIP_GZip_Fully_t, dll_lookup("ZIP_GZip_Fully", path, false));
9889
}
9990

10091
static void load_zip_library(bool vm_exit_on_failure) {

‎src/java.base/share/classes/sun/net/NetProperties.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ private static Properties loadDefaultProperties(Properties props) {
5656
} catch (IOException e) {
5757
// Do nothing. Same as below.
5858
}
59-
return;
59+
return props;
6060
}
6161

6262
String fname = StaticProperty.javaHome();

‎src/java.base/share/classes/sun/security/ssl/TrustStoreManager.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ private TrustStoreDescriptor(String storeName, String storeType,
121121
static TrustStoreDescriptor createInstance() {
122122
// Get the system properties for trust store.
123123
String storePropName = System.getProperty(
124-
"javax.net.ssl.trustStore", jsseDefaultStore);
124+
"javax.net.ssl.trustStore", jsseDefaultStoreName);
125125
String storePropType = System.getProperty(
126126
"javax.net.ssl.trustStoreType",
127127
KeyStore.getDefaultType());
@@ -177,7 +177,7 @@ static TrustStoreDescriptor createInstance() {
177177
if (FilePaths.class.getResource(fileName) != null) {
178178
// Keep temporaryFile as null in hermetic case.
179179
temporaryName = fileName;
180-
temporaryTime = JavaHome.hermeticImageFile().lastModified();
180+
temporaryTime = JavaHome.hermeticExecutableFile().lastModified();
181181
break;
182182
}
183183
}

‎src/java.base/share/native/libjimage/jimage.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
*/
4343
extern "C" {
4444
DEF_STATIC_JNI_OnLoad
45+
}
4546

4647
/*
4748
* JImageOpen - Given the supplied full path file name, open an image file. This

‎src/java.desktop/share/classes/sun/font/SunFontManager.java

+23-22
Original file line numberDiff line numberDiff line change
@@ -314,33 +314,34 @@ protected SunFontManager() {
314314
String name = br.readLine();
315315
if (name == null) {
316316
break;
317-
} else {
318-
if (FontUtilities.debugFonts()) {
319-
FontUtilities.logWarning("read bad font: " + name);
317+
} else {
318+
if (FontUtilities.debugFonts()) {
319+
FontUtilities.logWarning("read bad font: " + name);
320+
}
321+
badFonts.add(name);
320322
}
321-
badFonts.add(name);
322323
}
324+
} catch (IOException e) {
323325
}
324-
} catch (IOException e) {
325326
}
326-
}
327327

328-
/* Here we get the fonts in jre/lib/fonts and register
329-
* them so they are always available and preferred over
330-
* other fonts. This needs to be registered before the
331-
* composite fonts as otherwise some native font that
332-
* corresponds may be found as we don't have a way to
333-
* handle two fonts of the same name, so the JRE one
334-
* must be the first one registered. Pass "true" to
335-
* registerFonts method as on-screen these JRE fonts
336-
* always go through the JDK rasteriser.
337-
*/
338-
if (FontUtilities.isLinux) {
339-
/* Linux font configuration uses these fonts */
340-
registerFontDir(jreFontDirName);
341-
}
342-
registerFontsInDir(jreFontDirName, true, Font2D.JRE_RANK,
328+
/* Here we get the fonts in jre/lib/fonts and register
329+
* them so they are always available and preferred over
330+
* other fonts. This needs to be registered before the
331+
* composite fonts as otherwise some native font that
332+
* corresponds may be found as we don't have a way to
333+
* handle two fonts of the same name, so the JRE one
334+
* must be the first one registered. Pass "true" to
335+
* registerFonts method as on-screen these JRE fonts
336+
* always go through the JDK rasteriser.
337+
*/
338+
if (FontUtilities.isLinux) {
339+
/* Linux font configuration uses these fonts */
340+
registerFontDir(jreFontDirPath.toString());
341+
}
342+
registerFontsInDir(jreFontDirPath.toString(), true, Font2D.JRE_RANK,
343343
true, false);
344+
}
344345

345346
/* Create the font configuration and get any font path
346347
* that might be specified.
@@ -399,7 +400,7 @@ protected SunFontManager() {
399400
}
400401

401402
if (FontUtilities.debugFonts()) {
402-
FontUtilities.logInfo("JRE font directory: " + jreFontDirName);
403+
FontUtilities.logInfo("JRE font directory: " + jreFontDirPath);
403404
FontUtilities.logInfo("Extra font path: " + extraFontPath);
404405
FontUtilities.logInfo("Debug font path: " + dbgFontPath);
405406
}

‎src/java.desktop/unix/native/libawt/awt/awt_LoadLibrary.c

-3
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,6 @@ AWT_OnLoad(JavaVM *vm, void *reserved)
151151
jbuf);
152152

153153
awtHandle = dlopen(buf, RTLD_LAZY | RTLD_GLOBAL);
154-
} else {
155-
// FIXME: This should be integrated into mainline.
156-
awtHandle = dlopen(NULL, RTLD_LAZY);
157154
}
158155

159156
return JNI_VERSION_1_2;

‎src/java.logging/share/classes/java/util/logging/LogManager.java

+1-7
Original file line numberDiff line numberDiff line change
@@ -1264,13 +1264,7 @@ InputStream getConfigurationInputStream() throws IOException {
12641264
if (fname == null) {
12651265
String config = "logging.properties";
12661266
if (JavaHome.isHermetic()) {
1267-
PrivilegedAction<InputStream> getResourceAsStreamAction =
1268-
() -> LogManager.class.getResourceAsStream(config);
1269-
RuntimePermission perm =
1270-
new RuntimePermission("accessSystemModules");
1271-
try (@SuppressWarnings("removal") InputStream is =
1272-
AccessController.doPrivileged(
1273-
getResourceAsStreamAction, null, perm)) {
1267+
try (InputStream is = LogManager.class.getResourceAsStream(config)) {
12741268
if (is != null) {
12751269
return is;
12761270
} else {

0 commit comments

Comments
 (0)
Please sign in to comment.