aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2023-01-23 10:23:15 +0100
committerSven Gothel <[email protected]>2023-01-23 10:23:15 +0100
commite6cab620406492567e2194a3fac90ca76950272d (patch)
treea9b165612b5ed868edcff526f52931683375389e
parent55e0d96bddd01042fb0955d7a3864ac7879b612f (diff)
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()
-rw-r--r--src/java/com/jogamp/common/jvm/JNILibLoaderBase.java9
1 files changed, 6 insertions, 3 deletions
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<String> 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
}
}
}