aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/net
diff options
context:
space:
mode:
authorkbr <[email protected]>2007-07-21 00:05:07 +0000
committerkbr <[email protected]>2007-07-21 00:05:07 +0000
commit0a119eeb1e441e378b4b340493fcaccda4901cb2 (patch)
tree9586d621449063a11a45088cbb7c7a40a165b948 /src/java/net
parent0281de0ace6f224df4d4c354af8e46f629f786c0 (diff)
Synced loadLibraryInternal implementation with JNLPAppletLauncher's
recommended code git-svn-id: file:///home/mbien/NetBeansProjects/JOGAMP/joal-sync/git-svn/../svn-server-sync/joal/trunk@581 03bf7f67-59de-4072-a415-9a990d468a3f
Diffstat (limited to 'src/java/net')
-rwxr-xr-xsrc/java/net/java/games/joal/impl/NativeLibLoader.java13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/java/net/java/games/joal/impl/NativeLibLoader.java b/src/java/net/java/games/joal/impl/NativeLibLoader.java
index 1720825..acb843f 100755
--- a/src/java/net/java/games/joal/impl/NativeLibLoader.java
+++ b/src/java/net/java/games/joal/impl/NativeLibLoader.java
@@ -36,6 +36,7 @@
package net.java.games.joal.impl;
+import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.security.*;
@@ -94,7 +95,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);