mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-19 02:24:40 +02:00
8275703: System.loadLibrary fails on Big Sur for libraries hidden from filesystem
Reviewed-by: dholmes, alanb, mcimadamore
This commit is contained in:
parent
abe52aea23
commit
309acbf0e8
10 changed files with 199 additions and 32 deletions
|
@ -3369,7 +3369,7 @@ JVM_END
|
|||
|
||||
// Library support ///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
JVM_ENTRY_NO_ENV(void*, JVM_LoadLibrary(const char* name))
|
||||
JVM_ENTRY_NO_ENV(void*, JVM_LoadLibrary(const char* name, jboolean throwException))
|
||||
//%note jvm_ct
|
||||
char ebuf[1024];
|
||||
void *load_result;
|
||||
|
@ -3378,18 +3378,23 @@ JVM_ENTRY_NO_ENV(void*, JVM_LoadLibrary(const char* name))
|
|||
load_result = os::dll_load(name, ebuf, sizeof ebuf);
|
||||
}
|
||||
if (load_result == NULL) {
|
||||
char msg[1024];
|
||||
jio_snprintf(msg, sizeof msg, "%s: %s", name, ebuf);
|
||||
// Since 'ebuf' may contain a string encoded using
|
||||
// platform encoding scheme, we need to pass
|
||||
// Exceptions::unsafe_to_utf8 to the new_exception method
|
||||
// as the last argument. See bug 6367357.
|
||||
Handle h_exception =
|
||||
Exceptions::new_exception(thread,
|
||||
vmSymbols::java_lang_UnsatisfiedLinkError(),
|
||||
msg, Exceptions::unsafe_to_utf8);
|
||||
if (throwException) {
|
||||
char msg[1024];
|
||||
jio_snprintf(msg, sizeof msg, "%s: %s", name, ebuf);
|
||||
// Since 'ebuf' may contain a string encoded using
|
||||
// platform encoding scheme, we need to pass
|
||||
// Exceptions::unsafe_to_utf8 to the new_exception method
|
||||
// as the last argument. See bug 6367357.
|
||||
Handle h_exception =
|
||||
Exceptions::new_exception(thread,
|
||||
vmSymbols::java_lang_UnsatisfiedLinkError(),
|
||||
msg, Exceptions::unsafe_to_utf8);
|
||||
|
||||
THROW_HANDLE_0(h_exception);
|
||||
THROW_HANDLE_0(h_exception);
|
||||
} else {
|
||||
log_info(library)("Failed to load library %s", name);
|
||||
return load_result;
|
||||
}
|
||||
}
|
||||
log_info(library)("Loaded library %s, handle " INTPTR_FORMAT, name, p2i(load_result));
|
||||
return load_result;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue