From 2e80e7e60a48d3121feb20a237df304b2bf834d4 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Thu, 1 Dec 2011 20:18:27 +0100 Subject: TempJarCache/JNILibLoaderBase: Identify the Jar files by their URL within our lifecycle. JarFile's hash almost always differs. --- src/junit/com/jogamp/common/util/TestJarUtil.java | 4 ++-- src/junit/com/jogamp/common/util/TestTempJarCache.java | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/junit') diff --git a/src/junit/com/jogamp/common/util/TestJarUtil.java b/src/junit/com/jogamp/common/util/TestJarUtil.java index fd3b93e..9eef97d 100644 --- a/src/junit/com/jogamp/common/util/TestJarUtil.java +++ b/src/junit/com/jogamp/common/util/TestJarUtil.java @@ -130,7 +130,7 @@ public class TestJarUtil { final ClassLoader rootCL = this.getClass().getClassLoader(); // Get containing JAR file "TestJarsInJar.jar" and add it to the TempJarCache - TempJarCache.addAll(GlueGenVersion.class, JarUtil.getJarFile("ClassInJar0", rootCL)); + TempJarCache.addAll(GlueGenVersion.class, JarUtil.getJarFileURL("ClassInJar0", rootCL), rootCL); // Fetch and load the contained "ClassInJar1.jar" final URL ClassInJar1_jarFileURL = JarUtil.getJarFileURL(TempJarCache.getResource("ClassInJar1.jar")); @@ -151,7 +151,7 @@ public class TestJarUtil { final ClassLoader rootCL = this.getClass().getClassLoader(); // Get containing JAR file "TestJarsInJar.jar" and add it to the TempJarCache - TempJarCache.addAll(GlueGenVersion.class, JarUtil.getJarFile("ClassInJar0", rootCL)); + TempJarCache.addAll(GlueGenVersion.class, JarUtil.getJarFileURL("ClassInJar0", rootCL), rootCL); // Fetch and load the contained "ClassInJar1.jar" final URL ClassInJar2_jarFileURL = JarUtil.getJarFileURL(TempJarCache.getResource("sub/ClassInJar2.jar")); diff --git a/src/junit/com/jogamp/common/util/TestTempJarCache.java b/src/junit/com/jogamp/common/util/TestTempJarCache.java index 199d0aa..f1630d4 100644 --- a/src/junit/com/jogamp/common/util/TestTempJarCache.java +++ b/src/junit/com/jogamp/common/util/TestTempJarCache.java @@ -161,8 +161,9 @@ public class TestTempJarCache { Assert.assertTrue(TempJarCache.initSingleton()); Assert.assertTrue(TempCacheReg.isTempJarCacheUsed()); Assert.assertTrue(TempJarCache.isInitialized()); - - TempJarCache.addAll(GlueGenVersion.class, JarUtil.getJarFile(GlueGenVersion.class.getName(), getClass().getClassLoader())); + + final ClassLoader cl = getClass().getClassLoader(); + TempJarCache.addAll(GlueGenVersion.class, JarUtil.getJarFileURL(GlueGenVersion.class.getName(), cl), cl); File f0 = new File(TempJarCache.getTempFileCache().getTempDir(), "META-INF/MANIFEST.MF"); Assert.assertTrue(f0.exists()); @@ -189,9 +190,8 @@ public class TestTempJarCache { jarUrlRoot = JarUtil.getURLDirname(jarUrlRoot); URL nativeJarURL = JarUtil.getJarFileURL(jarUrlRoot, nativeJarName); - JarFile nativeJar = JarUtil.getJarFile(nativeJarURL, cl); - TempJarCache.addNativeLibs(TempJarCache.class, nativeJar); + TempJarCache.addNativeLibs(TempJarCache.class, nativeJarURL, cl); String libFullPath = TempJarCache.findLibrary(libBaseName); Assert.assertNotNull(libFullPath); Assert.assertEquals(libBaseName, NativeLibrary.isValidNativeLibraryName(libFullPath, true)); -- cgit v1.2.3