diff options
author | Sven Gothel <[email protected]> | 2012-10-25 11:35:05 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2012-10-25 11:35:05 +0200 |
commit | abbe6ce0973fbd82971ace1866515beefcc41817 (patch) | |
tree | 436ec13917574704841984c820e429e88fcb873a /src | |
parent | 661a625ed69faf701b6e868225148f630c2002d8 (diff) |
Fix Bug 608: Push down TempJarCache.findLibrary(..) from JNILibLoaderBase.loadLibraryInternal() to NativeLibrary.findLibrary(..)
This allows using TempJarCache (if used/initialized) for native 'tool' libraries as well.
This is the case of JOAL's attempt to load the provided 'libopenal.so'
Diffstat (limited to 'src')
-rw-r--r-- | src/java/com/jogamp/common/jvm/JNILibLoaderBase.java | 14 | ||||
-rwxr-xr-x | src/java/com/jogamp/common/os/NativeLibrary.java | 17 |
2 files changed, 15 insertions, 16 deletions
diff --git a/src/java/com/jogamp/common/jvm/JNILibLoaderBase.java b/src/java/com/jogamp/common/jvm/JNILibLoaderBase.java index 827b361..94f451e 100644 --- a/src/java/com/jogamp/common/jvm/JNILibLoaderBase.java +++ b/src/java/com/jogamp/common/jvm/JNILibLoaderBase.java @@ -425,20 +425,8 @@ public class JNILibLoaderBase { throw (UnsatisfiedLinkError) new UnsatisfiedLinkError("can not load library "+libraryName).initCause(e); } } else { - if(TempJarCache.isInitialized()) { - final String libraryPath = TempJarCache.findLibrary(libraryName); - if(null != libraryPath) { - if(DEBUG) { - System.err.println("JNILibLoaderBase: loadLibraryInternal("+libraryName+") -> System.load("+libraryPath+") (TempJarCache)"); - } - System.load(libraryPath); - return; // done - } else if(DEBUG) { - System.err.println("JNILibLoaderBase: loadLibraryInternal("+libraryName+") -> TempJarCache not mapped"); - } - } // System.err.println("sun.boot.library.path=" + Debug.getProperty("sun.boot.library.path", false)); - final String libraryPath = NativeLibrary.findLibrary(libraryName, cl); + final String libraryPath = NativeLibrary.findLibrary(libraryName, cl); // implicit TempJarCache usage if used/initialized if(DEBUG) { System.err.print("JNILibLoaderBase: loadLibraryInternal("+libraryName+"): CL: "+libraryPath); } diff --git a/src/java/com/jogamp/common/os/NativeLibrary.java b/src/java/com/jogamp/common/os/NativeLibrary.java index 1fc2e65..f5265af 100755 --- a/src/java/com/jogamp/common/os/NativeLibrary.java +++ b/src/java/com/jogamp/common/os/NativeLibrary.java @@ -41,6 +41,8 @@ package com.jogamp.common.os; import com.jogamp.common.util.IOUtil; +import com.jogamp.common.util.cache.TempJarCache; + import jogamp.common.os.MacOSXDynamicLinkerImpl; import jogamp.common.os.PlatformPropsImpl; import jogamp.common.os.UnixDynamicLinkerImpl; @@ -460,9 +462,18 @@ public class NativeLibrary implements DynamicLookupHelper { return null; } public static String findLibrary(final String libName, final ClassLoader loader) { - final String res = findLibraryImpl(libName, loader); - if (DEBUG) { - System.err.println("NativeLibrary.findLibrary(<"+libName+">, "+loader+"): "+res); + String res = null; + if(TempJarCache.isInitialized()) { + res = TempJarCache.findLibrary(libName); + if (DEBUG) { + System.err.println("NativeLibrary.findLibrary(<"+libName+">) (TempJarCache): "+res); + } + } + if(null == res) { + res = findLibraryImpl(libName, loader); + if (DEBUG) { + System.err.println("NativeLibrary.findLibrary(<"+libName+">, "+loader+") (CL): "+res); + } } return res; } |