From 0a119eeb1e441e378b4b340493fcaccda4901cb2 Mon Sep 17 00:00:00 2001 From: kbr Date: Sat, 21 Jul 2007 00:05:07 +0000 Subject: 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 --- src/java/net/java/games/joal/impl/NativeLibLoader.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) 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); -- cgit v1.2.3