From 5fb4d8ff3289ab5905f53edebd7ced396c6860d6 Mon Sep 17 00:00:00 2001 From: Kenneth Russel Date: Sat, 21 Jul 2007 00:06:04 +0000 Subject: Synced loadLibraryInternal implementation with JNLPAppletLauncher's recommended code git-svn-id: file:///usr/local/projects/SUN/JOGL/git-svn/svn-server-sync/jogl/trunk@1307 232f8b59-042b-4e1e-8c03-345bb8c30851 --- src/classes/com/sun/opengl/impl/NativeLibLoader.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/classes/com') diff --git a/src/classes/com/sun/opengl/impl/NativeLibLoader.java b/src/classes/com/sun/opengl/impl/NativeLibLoader.java index 91745d561..522b81a03 100644 --- a/src/classes/com/sun/opengl/impl/NativeLibLoader.java +++ b/src/classes/com/sun/opengl/impl/NativeLibLoader.java @@ -40,6 +40,7 @@ package com.sun.opengl.impl; import java.awt.Toolkit; +import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.security.AccessController; import java.security.PrivilegedAction; @@ -172,7 +173,17 @@ public class NativeLibLoader { } 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