diff options
author | Kenneth Russel <[email protected]> | 2007-07-21 00:04:47 +0000 |
---|---|---|
committer | Kenneth Russel <[email protected]> | 2007-07-21 00:04:47 +0000 |
commit | cc659efa4b20bfbce96227df9620c5f1cdd5f879 (patch) | |
tree | fe0fe42cca50e3b297da93893c97230806caeb1f /src/java/com/sun/gluegen/runtime/NativeLibLoader.java | |
parent | 65d923c910b4d90b91407f6d5fe266bc8e6571b1 (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
Diffstat (limited to 'src/java/com/sun/gluegen/runtime/NativeLibLoader.java')
-rwxr-xr-x | src/java/com/sun/gluegen/runtime/NativeLibLoader.java | 13 |
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); |