RFR: JDK-8293659: Improve UnsatisfiedLinkError error message to include dlopen error details

Mandy Chung mchung at openjdk.org
Thu Sep 15 17:46:27 UTC 2022


On Thu, 15 Sep 2022 11:54:41 GMT, Matthias Baesken <mbaesken at openjdk.org> wrote:

> When trying to load a x64 lib on macOS aarch64 one got previously this detailed message before [JDK-8275703](https://bugs.openjdk.org/browse/JDK-8275703):
> 
> java.lang.UnsatisfiedLinkError: /testing/jco3/macOsx64/libsapjco3.dylib: dlopen(/testing/jco3/macOsx64/libsapjco3.dylib, 1): no suitable image found. Did find:

src/java.base/share/classes/jdk/internal/loader/NativeLibraries.java line 347:

> 345:             // If the file exists but fails to load, UnsatisfiedLinkException thrown by the VM
> 346:             // will include the error message from dlopen to provide diagnostic information
> 347:             return fileExists;

Can drop the `fileExists` variable and simply `return AccessController.doPrivileged(....);`

Otherwise, looks good.

-------------

PR: https://git.openjdk.org/jdk/pull/10286


More information about the core-libs-dev mailing list