From cc659efa4b20bfbce96227df9620c5f1cdd5f879 Mon Sep 17 00:00:00 2001 From: Kenneth Russel Date: Sat, 21 Jul 2007 00:04:47 +0000 Subject: 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 --- src/java/com/sun/gluegen/runtime/NativeLibLoader.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src') 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); -- cgit v1.2.3