aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-06-18 10:42:52 +0200
committerSven Gothel <[email protected]>2013-06-18 10:42:52 +0200
commit88dca02541d96f68a892ae7824e9e1b29793ae55 (patch)
tree9f2d41323483d54133232901fdb49d8978c29910 /src
parent4feb65517ae4a4e2b9b04cdfc4b85582cb8b9784 (diff)
Refine 4feb65517ae4a4e2b9b04cdfc4b85582cb8b9784: Handle verbose error cases post catch block, i.e. exception (if occured) and dlerror value.
Diffstat (limited to 'src')
-rw-r--r--src/java/com/jogamp/common/os/NativeLibrary.java57
1 files changed, 31 insertions, 26 deletions
diff --git a/src/java/com/jogamp/common/os/NativeLibrary.java b/src/java/com/jogamp/common/os/NativeLibrary.java
index 3009ef3..f39ac77 100644
--- a/src/java/com/jogamp/common/os/NativeLibrary.java
+++ b/src/java/com/jogamp/common/os/NativeLibrary.java
@@ -184,32 +184,37 @@ public class NativeLibrary implements DynamicLookupHelper {
Platform.initSingleton(); // loads native gluegen-rt library
// Iterate down these and see which one if any we can actually find.
for (Iterator<String> iter = possiblePaths.iterator(); iter.hasNext(); ) {
- String path = iter.next();
- if (DEBUG) {
- System.err.println("NativeLibrary.open(global "+global+"): Trying to load " + path);
- }
- long res;
- try {
- if(global) {
- res = dynLink.openLibraryGlobal(path, DEBUG);
- } else {
- res = dynLink.openLibraryLocal(path, DEBUG);
- }
- } catch (Throwable t1) {
- if( DEBUG ) {
- System.err.println("NativeLibrary.open: Catched "+t1.getClass().getSimpleName()+": "+t1.getMessage());
- String errstr;
- try {
- errstr = dynLink.getLastError();
- } catch (Throwable t2) { errstr=null; }
- System.err.println("NativeLibrary.open: Last error "+errstr);
- t1.printStackTrace();
- }
- res = 0;
- }
- if (res != 0) {
- return new NativeLibrary(res, path, global);
- }
+ String path = iter.next();
+ if (DEBUG) {
+ System.err.println("NativeLibrary.open(global "+global+"): Trying to load " + path);
+ }
+ long res;
+ Throwable t = null;
+ try {
+ if(global) {
+ res = dynLink.openLibraryGlobal(path, DEBUG);
+ } else {
+ res = dynLink.openLibraryLocal(path, DEBUG);
+ }
+ } catch (Throwable t1) {
+ t = t1;
+ res = 0;
+ }
+ if ( 0 != res ) {
+ return new NativeLibrary(res, path, global);
+ } else if( DEBUG ) {
+ if( null != t ) {
+ System.err.println("NativeLibrary.open: Catched "+t.getClass().getSimpleName()+": "+t.getMessage());
+ }
+ String errstr;
+ try {
+ errstr = dynLink.getLastError();
+ } catch (Throwable t2) { errstr=null; }
+ System.err.println("NativeLibrary.open: Last error "+errstr);
+ if( null != t ) {
+ t.printStackTrace();
+ }
+ }
}
if (DEBUG) {