From e6cab620406492567e2194a3fac90ca76950272d Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Mon, 23 Jan 2023 10:23:15 +0100 Subject: JNILibLoaderBase.loadLibraryInternal(): Produce own detailed exception if lib couldn't be loaded (avoid showing misleading orig exception) .. and detail some debug output. Both, own exception and debug output expose NativeLibrary.getSystemEnvLibraryPaths() --- src/java/com/jogamp/common/jvm/JNILibLoaderBase.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/java/com') diff --git a/src/java/com/jogamp/common/jvm/JNILibLoaderBase.java b/src/java/com/jogamp/common/jvm/JNILibLoaderBase.java index 7859d2e..cccea1a 100644 --- a/src/java/com/jogamp/common/jvm/JNILibLoaderBase.java +++ b/src/java/com/jogamp/common/jvm/JNILibLoaderBase.java @@ -605,14 +605,14 @@ public class JNILibLoaderBase { mode = 2; } else { if(DEBUG) { - System.err.println("JNILibLoaderBase: System.loadLibrary("+libraryName+") - mode 3"); + System.err.println("JNILibLoaderBase: System.loadLibrary("+libraryName+") - mode 3: SystemEnvLibraryPaths: "+NativeLibrary.getSystemEnvLibraryPaths()); } try { System.loadLibrary(libraryName); mode = 3; } catch (final UnsatisfiedLinkError ex1) { if(DEBUG) { - System.err.println("ERROR (retry w/ enumLibPath) - "+ex1.getMessage()); + System.err.println("ERROR mode 3 - "+ex1.getMessage()); } final List possiblePaths = NativeLibrary.enumerateLibraryPaths(libraryName, libraryName, libraryName, cl); // Iterate down these and see which one if any we can actually find. @@ -629,7 +629,10 @@ public class JNILibLoaderBase { System.err.println("n/a - "+ex2.getMessage()); } if(!iter.hasNext()) { - throw ex2; + // Avoid misleading final exception, use our own + throw new UnsatisfiedLinkError("Couldn't load library '"+libraryName+ + "' generically including "+NativeLibrary.getSystemEnvLibraryPaths()+ // mode 3 + ", nor as "+possiblePaths); // mode 4 } } } -- cgit v1.2.3