From b98825eb7cfb61aead4a7dff57471cd2d2c26823 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sun, 9 Jun 2013 05:33:16 +0200 Subject: Fix Bug 683 part1: IOUtil, JarUtil, TempJarCache, .. uses URI instead of URL to remove DNS Lookups etc .. --- make/scripts/runtest.sh | 4 +- .../com/jogamp/common/jvm/JNILibLoaderBase.java | 41 ++-- .../com/jogamp/common/net/AssetURLContext.java | 9 +- src/java/com/jogamp/common/os/NativeLibrary.java | 15 +- src/java/com/jogamp/common/os/Platform.java | 28 +-- src/java/com/jogamp/common/util/IOUtil.java | 150 ++++++------ src/java/com/jogamp/common/util/JarUtil.java | 271 +++++++++++---------- .../com/jogamp/common/util/cache/TempJarCache.java | 149 ++++++----- .../net/AssetURLConnectionRegisteredTest.java | 38 +-- .../net/AssetURLConnectionUnregisteredTest.java | 16 +- .../com/jogamp/common/net/URLCompositionTest.java | 134 ++++++++-- src/junit/com/jogamp/common/util/TestJarUtil.java | 54 ++-- .../com/jogamp/common/util/TestTempJarCache.java | 22 +- 13 files changed, 532 insertions(+), 399 deletions(-) diff --git a/make/scripts/runtest.sh b/make/scripts/runtest.sh index 32e972c..a068c90 100755 --- a/make/scripts/runtest.sh +++ b/make/scripts/runtest.sh @@ -76,7 +76,7 @@ function onetest() { #onetest com.jogamp.common.GlueGenVersion 2>&1 | tee -a $LOG #onetest com.jogamp.common.util.TestSystemPropsAndEnvs 2>&1 | tee -a $LOG #onetest com.jogamp.common.util.TestVersionInfo 2>&1 | tee -a $LOG -onetest com.jogamp.common.util.TestVersionNumber 2>&1 | tee -a $LOG +#onetest com.jogamp.common.util.TestVersionNumber 2>&1 | tee -a $LOG #onetest com.jogamp.common.util.TestIteratorIndexCORE 2>&1 | tee -a $LOG #onetest com.jogamp.common.util.locks.TestRecursiveLock01 2>&1 | tee -a $LOG #onetest com.jogamp.common.util.locks.TestRecursiveThreadGroupLock01 2>&1 | tee -a $LOG @@ -100,7 +100,7 @@ onetest com.jogamp.common.util.TestVersionNumber 2>&1 | tee -a $LOG #onetest com.jogamp.common.util.TestRunnableTask01 2>&1 | tee -a $LOG #onetest com.jogamp.common.util.TestIOUtil01 2>&1 | tee -a $LOG #onetest com.jogamp.common.util.TestTempJarCache 2>&1 | tee -a $LOG -#onetest com.jogamp.common.util.TestJarUtil 2>&1 | tee -a $LOG +onetest com.jogamp.common.util.TestJarUtil 2>&1 | tee -a $LOG #onetest com.jogamp.common.util.TestValueConversion 2>&1 | tee -a $LOG #onetest com.jogamp.common.net.AssetURLConnectionUnregisteredTest 2>&1 | tee -a $LOG #onetest com.jogamp.common.net.AssetURLConnectionRegisteredTest 2>&1 | tee -a $LOG diff --git a/src/java/com/jogamp/common/jvm/JNILibLoaderBase.java b/src/java/com/jogamp/common/jvm/JNILibLoaderBase.java index d0d8003..5621396 100644 --- a/src/java/com/jogamp/common/jvm/JNILibLoaderBase.java +++ b/src/java/com/jogamp/common/jvm/JNILibLoaderBase.java @@ -42,7 +42,8 @@ package com.jogamp.common.jvm; import java.io.IOException; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; -import java.net.URL; +import java.net.URI; +import java.net.URISyntaxException; import java.security.AccessController; import java.security.PrivilegedAction; import java.util.Arrays; @@ -145,23 +146,23 @@ public class JNILibLoaderBase { loaderAction = action; } - /* pp */ static final boolean addNativeJarLibsImpl(Class classFromJavaJar, URL classJarURL, String nativeJarBasename, StringBuilder msg) - throws IOException, IllegalArgumentException, SecurityException + /* pp */ static final boolean addNativeJarLibsImpl(Class classFromJavaJar, URI classJarURI, String nativeJarBasename, StringBuilder msg) + throws IOException, SecurityException, URISyntaxException { msg.setLength(0); // reset - msg.append("addNativeJarLibsImpl(classFromJavaJar ").append(classFromJavaJar).append(", classJarURL ").append(classJarURL).append(", nativeJarBaseName ").append(nativeJarBasename).append("): "); + msg.append("addNativeJarLibsImpl(classFromJavaJar ").append(classFromJavaJar).append(", classJarURI ").append(classJarURI).append(", nativeJarBaseName ").append(nativeJarBasename).append("): "); boolean ok = false; if(TempJarCache.isInitialized()) { final String nativeJarName = nativeJarBasename+"-natives-"+PlatformPropsImpl.os_and_arch+".jar"; msg.append(nativeJarName); - final URL jarUrlRoot = JarUtil.getURLDirname( JarUtil.getJarSubURL( classJarURL ) ); - msg.append(" + ").append(jarUrlRoot); - final URL nativeJarURL = JarUtil.getJarFileURL(jarUrlRoot, nativeJarName); - msg.append(" -> ").append(nativeJarURL); + final URI jarUriRoot = JarUtil.getURIDirname( JarUtil.getJarSubURI( classJarURI ) ); + msg.append(" + ").append(jarUriRoot); + final URI nativeJarURI = JarUtil.getJarFileURI(jarUriRoot, nativeJarName); + msg.append(" -> ").append(nativeJarURI); if(DEBUG) { System.err.println(msg.toString()); } - TempJarCache.addNativeLibs(classFromJavaJar, nativeJarURL); + TempJarCache.addNativeLibs(classFromJavaJar, nativeJarURI); ok = true; } return ok; @@ -169,7 +170,7 @@ public class JNILibLoaderBase { /** * Loads and adds a JAR file's native library to the TempJarCache.
- * The native library JAR file's URL is derived as follows: + * The native library JAR file's URI is derived as follows: *