aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKenneth Russel <[email protected]>2007-07-21 00:04:47 +0000
committerKenneth Russel <[email protected]>2007-07-21 00:04:47 +0000
commitcc659efa4b20bfbce96227df9620c5f1cdd5f879 (patch)
treefe0fe42cca50e3b297da93893c97230806caeb1f
parent65d923c910b4d90b91407f6d5fe266bc8e6571b1 (diff)
Synced loadLibraryInternal implementation with JNLPAppletLauncher's
recommended code git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/../svn-server-sync/gluegen/trunk@68 a78bb65f-1512-4460-ba86-f6dc96a7bf27
-rwxr-xr-xsrc/java/com/sun/gluegen/runtime/NativeLibLoader.java13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/java/com/sun/gluegen/runtime/NativeLibLoader.java b/src/java/com/sun/gluegen/runtime/NativeLibLoader.java
index a879683..0e6e3da 100755
--- a/src/java/com/sun/gluegen/runtime/NativeLibLoader.java
+++ b/src/java/com/sun/gluegen/runtime/NativeLibLoader.java
@@ -39,6 +39,7 @@
package com.sun.gluegen.runtime;
+import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.security.*;
@@ -85,7 +86,17 @@ public class NativeLibLoader {
Method jnlpLoadLibraryMethod = jnlpAppletLauncherClass.getDeclaredMethod("loadLibrary", new Class[] { String.class });
jnlpLoadLibraryMethod.invoke(null, new Object[] { libraryName });
} catch (Exception e) {
- throw new RuntimeException(e);
+ Throwable t = e;
+ if (t instanceof InvocationTargetException) {
+ t = ((InvocationTargetException) t).getTargetException();
+ }
+ if (t instanceof Error)
+ throw (Error) t;
+ if (t instanceof RuntimeException) {
+ throw (RuntimeException) t;
+ }
+ // Throw UnsatisfiedLinkError for best compatibility with System.loadLibrary()
+ throw (UnsatisfiedLinkError) new UnsatisfiedLinkError().initCause(e);
}
} else {
System.loadLibrary(libraryName);