summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/java/com/jogamp/common/jvm/JNILibLoaderBase.java140
-rw-r--r--src/java/com/jogamp/common/net/URIQueryProps.java137
-rw-r--r--src/java/com/jogamp/common/os/Platform.java14
-rw-r--r--src/java/com/jogamp/common/util/IOUtil.java119
-rw-r--r--src/java/com/jogamp/common/util/JarUtil.java83
-rw-r--r--src/java/com/jogamp/common/util/PropertyAccess.java9
-rw-r--r--src/java/com/jogamp/common/util/VersionUtil.java4
-rw-r--r--src/java/com/jogamp/common/util/cache/TempJarCache.java101
-rw-r--r--src/java/jogamp/common/os/PlatformPropsImpl.java15
-rw-r--r--src/junit/com/jogamp/common/net/AssetURLConnectionRegisteredTest.java4
-rw-r--r--src/junit/com/jogamp/common/net/AssetURLConnectionUnregisteredTest.java4
-rw-r--r--src/junit/com/jogamp/common/net/URLCompositionTest.java30
-rw-r--r--src/junit/com/jogamp/common/nio/BuffersTest.java4
-rw-r--r--src/junit/com/jogamp/common/nio/CachedBufferFactoryTest.java4
-rw-r--r--src/junit/com/jogamp/common/nio/TestBuffersFloatDoubleConversion.java4
-rw-r--r--src/junit/com/jogamp/common/nio/TestPointerBufferEndian.java4
-rw-r--r--src/junit/com/jogamp/common/nio/TestStructAccessorEndian.java4
-rw-r--r--src/junit/com/jogamp/common/os/TestElfReader01.java4
-rw-r--r--src/junit/com/jogamp/common/util/IntIntHashMapTest.java4
-rw-r--r--src/junit/com/jogamp/common/util/IntObjectHashMapTest.java4
-rw-r--r--src/junit/com/jogamp/common/util/LongIntHashMapTest.java4
-rw-r--r--src/junit/com/jogamp/common/util/TestArrayHashSet01.java4
-rw-r--r--src/junit/com/jogamp/common/util/TestFloatStack01.java4
-rw-r--r--src/junit/com/jogamp/common/util/TestIOUtil01.java4
-rw-r--r--src/junit/com/jogamp/common/util/TestIteratorIndexCORE.java4
-rw-r--r--src/junit/com/jogamp/common/util/TestJarUtil.java4
-rw-r--r--src/junit/com/jogamp/common/util/TestLFRingBuffer01.java4
-rw-r--r--src/junit/com/jogamp/common/util/TestPlatform01.java4
-rw-r--r--src/junit/com/jogamp/common/util/TestRunnableTask01.java4
-rw-r--r--src/junit/com/jogamp/common/util/TestSyncRingBuffer01.java4
-rw-r--r--src/junit/com/jogamp/common/util/TestSystemPropsAndEnvs.java4
-rw-r--r--src/junit/com/jogamp/common/util/TestTempJarCache.java10
-rw-r--r--src/junit/com/jogamp/common/util/TestValueConversion.java4
-rw-r--r--src/junit/com/jogamp/common/util/TestVersionInfo.java4
-rw-r--r--src/junit/com/jogamp/common/util/TestVersionNumber.java4
-rw-r--r--src/junit/com/jogamp/common/util/locks/TestRecursiveLock01.java4
-rw-r--r--src/junit/com/jogamp/common/util/locks/TestRecursiveThreadGroupLock01.java4
-rw-r--r--src/junit/com/jogamp/common/util/locks/TestSingletonServerSocket00.java4
-rw-r--r--src/junit/com/jogamp/common/util/locks/TestSingletonServerSocket01.java4
-rw-r--r--src/junit/com/jogamp/common/util/locks/TestSingletonServerSocket02.java4
-rw-r--r--src/junit/com/jogamp/gluegen/test/junit/generation/PCPPTest.java4
-rw-r--r--src/junit/com/jogamp/gluegen/test/junit/generation/Test1p1JavaEmitter.java4
-rw-r--r--src/junit/com/jogamp/gluegen/test/junit/generation/Test1p2ProcAddressEmitter.java4
-rw-r--r--src/junit/com/jogamp/gluegen/test/junit/structgen/TestStructGen01.java4
-rw-r--r--src/junit/com/jogamp/junit/sec/TestSecIOUtil01.java4
-rw-r--r--src/junit/com/jogamp/junit/util/JunitTracer.java3
46 files changed, 625 insertions, 176 deletions
diff --git a/src/java/com/jogamp/common/jvm/JNILibLoaderBase.java b/src/java/com/jogamp/common/jvm/JNILibLoaderBase.java
index 2023162..67cc05c 100644
--- a/src/java/com/jogamp/common/jvm/JNILibLoaderBase.java
+++ b/src/java/com/jogamp/common/jvm/JNILibLoaderBase.java
@@ -44,6 +44,7 @@ import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.URI;
import java.net.URISyntaxException;
+import java.net.URL;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Arrays;
@@ -147,24 +148,56 @@ public class JNILibLoaderBase {
loaderAction = action;
}
- /* pp */ static final boolean addNativeJarLibsImpl(Class<?> classFromJavaJar, URI classJarURI, String nativeJarBasename, StringBuilder msg)
+ /**
+ *
+ * @param classFromJavaJar
+ * @param classJarURI
+ * @param jarBasename jar basename w/ suffix
+ * @param nativeJarBasename native jar basename w/ suffix
+ * @param msg
+ * @return
+ * @throws IOException
+ * @throws SecurityException
+ * @throws URISyntaxException
+ */
+ /* pp */ static final boolean addNativeJarLibsImpl(Class<?> classFromJavaJar, URI classJarURI, String jarBasename, String nativeJarBasename, StringBuilder msg)
throws IOException, SecurityException, URISyntaxException
{
msg.setLength(0); // reset
- msg.append("addNativeJarLibsImpl(classFromJavaJar ").append(classFromJavaJar).append(", classJarURI ").append(classJarURI).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 URI jarUriRoot = IOUtil.getDirname( 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());
+ if(TempJarCache.isInitialized()) {
+ final URI jarSubURI = JarUtil.getJarSubURI( classJarURI );
+ if(null == jarSubURI) {
+ throw new IllegalArgumentException("JarSubURI is null of: "+classJarURI);
+ }
+ final String jarUriRoot_s = IOUtil.getURIDirname( jarSubURI.toString() );
+ msg.append("[ ").append(jarSubURI.toString()).append(" -> ").append(jarUriRoot_s).append(" ] + ");
+
+ final String nativeLibraryPath = "natives/"+PlatformPropsImpl.os_and_arch+"/";
+ final ClassLoader cl = classFromJavaJar.getClassLoader();
+ final URL nativeLibraryURI = cl.getResource(nativeLibraryPath);
+ if( null != nativeLibraryURI ) {
+ // We probably have one big-fat jar file, containing java classes
+ // and all native platform libraries under 'natives/os.and.arch'!
+ final URI nativeJarURI = JarUtil.getJarFileURI(jarUriRoot_s+jarBasename);
+ if( TempJarCache.addNativeLibs(classFromJavaJar, nativeJarURI, nativeLibraryPath) ) {
+ ok = true;
+ msg.append(jarBasename).append(" -> fat: ").append(nativeJarURI);
+ }
}
- TempJarCache.addNativeLibs(classFromJavaJar, nativeJarURI);
- ok = true;
+ if( !ok ) {
+ // We assume one slim native jar file per 'os.and.arch'!
+ final URI nativeJarURI = JarUtil.getJarFileURI(jarUriRoot_s+nativeJarBasename);
+ msg.append(nativeJarBasename).append(" -> slim: ").append(nativeJarURI);
+ ok = TempJarCache.addNativeLibs(classFromJavaJar, nativeJarURI, null /* nativeLibraryPath */);
+ }
+ } else {
+ msg.append("TempJarCache n/a");
+ }
+ if(DEBUG) {
+ System.err.println(msg.toString()+" - OK "+ok);
}
return ok;
}
@@ -193,7 +226,8 @@ public class JNILibLoaderBase {
final StringBuilder msg = new StringBuilder();
try {
final URI classJarURI = JarUtil.getJarURI(classFromJavaJar.getName(), classFromJavaJar.getClassLoader());
- return addNativeJarLibsImpl(classFromJavaJar, classJarURI, nativeJarBasename, msg);
+ final String jarName = JarUtil.getJarBasename(classJarURI);
+ return addNativeJarLibsImpl(classFromJavaJar, classJarURI, jarName, nativeJarBasename+"-natives-"+PlatformPropsImpl.os_and_arch+".jar", msg);
} catch (Exception e0) {
// IllegalArgumentException, IOException
System.err.println("Catched "+e0.getClass().getSimpleName()+": "+e0.getMessage()+", while "+msg.toString());
@@ -208,6 +242,30 @@ public class JNILibLoaderBase {
}
/**
+ * Loads and adds a JAR file's native library to the TempJarCache,
+ * calling {@link JNILibLoaderBase#addNativeJarLibs(Class[], String, String[])}
+ * with default JOGL deployment configuration:
+ * <pre>
+ return JNILibLoaderBase.addNativeJarLibs(classesFromJavaJars, "-all", new String[] { "-noawt", "-mobile", "-core", "-android" } );
+ * </pre>
+ * If <code>Class1.class</code> is contained in a JAR file which name includes <code>singleJarMarker</code> <i>-all</i>,
+ * implementation will attempt to resolve the native JAR file as follows:
+ * <ul>
+ * <li><i>ClassJar-all</i>[-noawt,-mobile,-android]?.jar to <i>ClassJar-all</i>-natives-<i>os.and.arch</i>.jar</li>
+ * </ul>
+ * Otherwise the native JAR files will be resolved for each class's JAR file:
+ * <ul>
+ * <li><i>ClassJar1</i>[-noawt,-mobile,-core,-android]?.jar to <i>ClassJar1</i>-natives-<i>os.and.arch</i>.jar</li>
+ * <li><i>ClassJar2</i>[-noawt,-mobile,-core,-android]?.jar to <i>ClassJar2</i>-natives-<i>os.and.arch</i>.jar</li>
+ * <li>..</li>
+ * </ul>
+ */
+ public static final boolean addNativeJarLibsJoglCfg(final Class<?>[] classesFromJavaJars) {
+ return addNativeJarLibs(classesFromJavaJars, "-all", joglDeployCfg);
+ }
+ private static final String[] joglDeployCfg = new String[] { "-noawt", "-mobile", "-core", "-android" };
+
+ /**
* Loads and adds a JAR file's native library to the TempJarCache.<br>
* The native library JAR file's URI is derived as follows:
* <ul>
@@ -223,37 +281,59 @@ public class JNILibLoaderBase {
* <li> [3] is it's <i>base URI</i></li>
* <li> [4] is the derived native JAR filename</li>
* </ul>
- *
- * Examples:<br>
- * <br>
+ * <p>
+ * Generic description:
+ * <pre>
+ final ClassLoader cl = GLProfile.class.getClassLoader();
+ final String newtFactoryClassName = "com.jogamp.newt.NewtFactory";
+ final Class<?>[] classesFromJavaJars = new Class<?>[] { Class1.class, Class2.class };
+ JNILibLoaderBase.addNativeJarLibs(classesFromJavaJars, "-all", new String[] { "-suff1", "-suff2" } );
+ * </pre>
+ * If <code>Class1.class</code> is contained in a JAR file which name includes <code>singleJarMarker</code>, here <i>-all</i>,
+ * implementation will attempt to resolve the native JAR file as follows:
+ * <ul>
+ * <li><i>ClassJar-all</i>[-suff1,-suff2]?.jar to <i>ClassJar-all</i>-natives-<i>os.and.arch</i>.jar</li>
+ * </ul>
+ * Otherwise the native JAR files will be resolved for each class's JAR file:
+ * <ul>
+ * <li><i>Class1Jar</i>[-suff1,-suff2]?.jar to <i>Class1Jar</i>-natives-<i>os.and.arch</i>.jar</li>
+ * <li><i>Class2Jar</i>[-suff1,-suff2]?.jar to <i>Class2Jar</i>-natives-<i>os.and.arch</i>.jar</li>
+ * </ul>
+ * </p>
+ * <p>
+ * Examples:
+ * </p>
+ * <p>
* JOCL:
* <pre>
- // only: jocl.jar -> jocl-natives-'os.and.arch'.jar
+ // only: jocl.jar -> jocl-natives-<i>os.and.arch</i>.jar
addNativeJarLibs(new Class<?>[] { JOCLJNILibLoader.class }, null, null );
* </pre>
*
* Newt Only:
* <pre>
- // either: [jogl-all.jar, jogl-all-noawt.jar, jogl-all-mobile.jar] -> jogl-all-natives-<os.and.arch>.jar
- // or: nativewindow-core.jar -> nativewindow-natives-<os.and.arch>.jar,
- // newt-core.jar -> newt-natives-<os.and.arch>.jar
- JNILibLoaderBase.addNativeJarLibs(new Class<?>[] { NWJNILibLoader.class, NEWTJNILibLoader.class }, "-all", new String[] { "-noawt", "-mobile", "-core" } );
+ // either: [jogl-all.jar, jogl-all-noawt.jar, jogl-all-mobile.jar, jogl-all-android.jar] -> jogl-all-natives-<i>os.and.arch</i>.jar
+ // or: nativewindow-core.jar -> nativewindow-natives-<i>os.and.arch</i>.jar,
+ // newt-core.jar -> newt-natives-<i>os.and.arch</i>.jar
+ JNILibLoaderBase.addNativeJarLibs(new Class<?>[] { NWJNILibLoader.class, NEWTJNILibLoader.class }, "-all", new String[] { "-noawt", "-mobile", "-core", "-android" } );
* </pre>
- *
+ * </p>
+ * <p>
* JOGL:
* <pre>
final ClassLoader cl = GLProfile.class.getClassLoader();
- // either: [jogl-all.jar, jogl-all-noawt.jar, jogl-all-mobile.jar] -> jogl-all-natives-<os.and.arch>.jar
- // or: nativewindow-core.jar -> nativewindow-natives-<os.and.arch>.jar,
- // jogl-core.jar -> jogl-natives-<os.and.arch>.jar,
- // (newt-core.jar -> newt-natives-<os.and.arch>.jar)? (if available)
+ // either: [jogl-all.jar, jogl-all-noawt.jar, jogl-all-mobile.jar, jogl-all-android.jar] -> jogl-all-natives-<i>os.and.arch</i>.jar
+ // or: nativewindow-core.jar -> nativewindow-natives-<i>os.and.arch</i>.jar,
+ // jogl-core.jar -> jogl-natives-<i>os.and.arch</i>.jar,
+ // (newt-core.jar -> newt-natives-<i>os.and.arch</i>.jar)? (if available)
final String newtFactoryClassName = "com.jogamp.newt.NewtFactory";
final Class<?>[] classesFromJavaJars = new Class<?>[] { NWJNILibLoader.class, GLProfile.class, null };
if( ReflectionUtil.isClassAvailable(newtFactoryClassName, cl) ) {
classesFromJavaJars[2] = ReflectionUtil.getClass(newtFactoryClassName, false, cl);
}
- JNILibLoaderBase.addNativeJarLibs(classesFromJavaJars, "-all", new String[] { "-noawt", "-mobile", "-core" } );
+ JNILibLoaderBase.addNativeJarLibs(classesFromJavaJars, "-all", new String[] { "-noawt", "-mobile", "-core", "-android" } );
* </pre>
+ * </p>
*
* @param classesFromJavaJars For each given Class, load the native library JAR.
* @param singleJarMarker Optional string marker like "-all" to identify the single 'all-in-one' JAR file
@@ -281,9 +361,9 @@ public class JNILibLoaderBase {
ok = null != jarName;
if(ok) {
final String jarBasename = jarName.substring(0, jarName.indexOf(".jar")); // ".jar" already validated w/ JarUtil.getJarBasename(..)
- final String nativeJarBasename = stripName(jarBasename, stripBasenameSuffixes);
+ final String nativeJarBasename = stripName(jarBasename, stripBasenameSuffixes)+"-natives-"+PlatformPropsImpl.os_and_arch+".jar";
done = null != singleJarMarker && jarBasename.indexOf(singleJarMarker) >= 0; // done if single-jar ('all' variant)
- ok = JNILibLoaderBase.addNativeJarLibsImpl(classesFromJavaJars[i], classJarURI, nativeJarBasename, msg);
+ ok = JNILibLoaderBase.addNativeJarLibsImpl(classesFromJavaJars[i], classJarURI, jarName, nativeJarBasename, msg);
if(ok) { count++; }
if(DEBUG && done) {
System.err.println("JNILibLoaderBase: addNativeJarLibs0: end after all-in-one JAR: "+jarBasename);
diff --git a/src/java/com/jogamp/common/net/URIQueryProps.java b/src/java/com/jogamp/common/net/URIQueryProps.java
new file mode 100644
index 0000000..fd91b9b
--- /dev/null
+++ b/src/java/com/jogamp/common/net/URIQueryProps.java
@@ -0,0 +1,137 @@
+/**
+ * Copyright 2013 JogAmp Community. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without modification, are
+ * permitted provided that the following conditions are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright notice, this list of
+ * conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright notice, this list
+ * of conditions and the following disclaimer in the documentation and/or other materials
+ * provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY JogAmp Community ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL JogAmp Community OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * The views and conclusions contained in the software and documentation are those of the
+ * authors and should not be interpreted as representing official policies, either expressed
+ * or implied, of JogAmp Community.
+ */
+package com.jogamp.common.net;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Map.Entry;
+
+/**
+ * Helper class to process URI's query, handled as properties.
+ * <p>
+ * The order of the URI segments (any properties) are <i>not</i> preserved.
+ * </p>
+ * <pre>
+ * URI: [scheme:][//authority][path][?query][#fragment]
+ * w/ authority: [user-info@]host[:port]
+ * Note: 'path' starts w/ fwd slash
+ * </pre>
+ */
+public class URIQueryProps {
+ private static final String QMARK = "?";
+ private static final char ASSIG = '=';
+ private static final String EMPTY = "";
+ private final String query_separator;
+
+ private final HashMap<String, String> properties = new HashMap<String, String>();
+
+ private URIQueryProps(char querySeparator) {
+ query_separator = String.valueOf(querySeparator);
+ }
+
+ public final Map<String, String> getProperties() { return properties; }
+ public final char getQuerySeparator() { return query_separator.charAt(0); }
+
+ public final String appendQuery(String baseQuery) {
+ boolean needsSep = false;
+ final StringBuilder sb = new StringBuilder();
+ if ( null != baseQuery ) {
+ if( !baseQuery.startsWith(QMARK) ) {
+ baseQuery = baseQuery.substring(1);
+ }
+ sb.append(baseQuery);
+ if( !baseQuery.endsWith(query_separator) ) {
+ needsSep = true;
+ }
+ }
+ Iterator<Entry<String, String>> entries = properties.entrySet().iterator();
+ while(entries.hasNext()) {
+ if(needsSep) {
+ sb.append(query_separator);
+ }
+ final Entry<String, String> entry = entries.next();
+ sb.append(entry.getKey());
+ if( EMPTY != entry.getValue() ) {
+ sb.append(ASSIG).append(entry.getValue());
+ }
+ needsSep = true;
+ }
+ return sb.toString();
+ }
+
+ public final URI appendQuery(URI base) throws URISyntaxException {
+ return new URI(base.getScheme(),
+ base.getRawUserInfo(), base.getHost(), base.getPort(),
+ base.getRawPath(), appendQuery(base.getRawQuery()), base.getRawFragment());
+ }
+
+ /**
+ *
+ * @param uri
+ * @param querySeparator should be either <i>;</i> or <i>&</i>, <i>;</i> is encouraged due to troubles of escaping <i>&</i>.
+ * @return
+ * @throws IllegalArgumentException if <code>querySeparator</code> is illegal, i.e. neither <i>;</i> nor <i>&</i>
+ */
+ public static final URIQueryProps create(URI uri, char querySeparator) throws IllegalArgumentException {
+ if( ';' != querySeparator && '&' != querySeparator ) {
+ throw new IllegalArgumentException("querySeparator is invalid: "+querySeparator);
+ }
+ final URIQueryProps data = new URIQueryProps(querySeparator);
+ final String q = uri.getQuery();
+ final int q_l = null != q ? q.length() : -1;
+ int q_e = -1;
+ while(q_e < q_l) {
+ int q_b = q_e + 1; // next term
+ q_e = q.indexOf(querySeparator, q_b);
+ if(0 == q_e) {
+ // single separator
+ continue;
+ }
+ if(0 > q_e) {
+ // end
+ q_e = q_l;
+ }
+ // n-part
+ final String part = q.substring(q_b, q_e);
+ final int assignment = part.indexOf(ASSIG);
+ if(0 < assignment) {
+ // assignment
+ final String k = part.substring(0, assignment);
+ final String v = part.substring(assignment+1);
+ data.properties.put(k, v);
+ } else {
+ // property key only
+ data.properties.put(part, EMPTY);
+ }
+ }
+ return data;
+ }
+}
diff --git a/src/java/com/jogamp/common/os/Platform.java b/src/java/com/jogamp/common/os/Platform.java
index 32fc9f4..a01a4b4 100644
--- a/src/java/com/jogamp/common/os/Platform.java
+++ b/src/java/com/jogamp/common/os/Platform.java
@@ -33,7 +33,7 @@ import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.concurrent.TimeUnit;
-import com.jogamp.common.util.IOUtil;
+import com.jogamp.common.jvm.JNILibLoaderBase;
import com.jogamp.common.util.JarUtil;
import com.jogamp.common.util.ReflectionUtil;
import com.jogamp.common.util.VersionNumber;
@@ -192,19 +192,11 @@ public class Platform extends PlatformPropsImpl {
// load GluegenRT native library
if(_USE_TEMP_JAR_CACHE[0] && TempJarCache.initSingleton()) {
- String nativeJarName = null;
- URI jarUriRoot = null;
- URI nativeJarURI = null;
try {
- final String jarName = JarUtil.getJarBasename( platformClassJarURI );
- final String nativeJarBasename = jarName.substring(0, jarName.indexOf(".jar")); // ".jar" already validated w/ JarUtil.getJarBasename(..)
- nativeJarName = nativeJarBasename+"-natives-"+PlatformPropsImpl.os_and_arch+".jar";
- jarUriRoot = IOUtil.getDirname( JarUtil.getJarSubURI( platformClassJarURI ) );
- nativeJarURI = JarUtil.getJarFileURI(jarUriRoot, nativeJarName);
- TempJarCache.bootstrapNativeLib(Platform.class, libBaseName, nativeJarURI);
+ JNILibLoaderBase.addNativeJarLibs(new Class<?>[] { Platform.class }, null, null );
} catch (Exception e0) {
// IllegalArgumentException, IOException
- System.err.println("Catched "+e0.getClass().getSimpleName()+": "+e0.getMessage()+", while TempJarCache.bootstrapNativeLib() of "+nativeJarURI+" ("+jarUriRoot+" + "+nativeJarName+")");
+ System.err.println("Catched "+e0.getClass().getSimpleName()+": "+e0.getMessage()+", while JNILibLoaderBase.addNativeJarLibs(..)");
}
}
DynamicLibraryBundle.GlueJNILibLoader.loadLibrary(libBaseName, false, cl);
diff --git a/src/java/com/jogamp/common/util/IOUtil.java b/src/java/com/jogamp/common/util/IOUtil.java
index de5a8ea..242f300 100644
--- a/src/java/com/jogamp/common/util/IOUtil.java
+++ b/src/java/com/jogamp/common/util/IOUtil.java
@@ -43,6 +43,7 @@ import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLConnection;
import java.nio.ByteBuffer;
+import java.util.regex.Pattern;
import jogamp.common.Debug;
import jogamp.common.os.AndroidUtils;
@@ -169,7 +170,22 @@ public class IOUtil {
* @throws IOException
*/
public static int copyStream2Stream(InputStream in, OutputStream out, int totalNumBytes) throws IOException {
- final byte[] buf = new byte[Platform.getMachineDescription().pageSizeInBytes()];
+ return copyStream2Stream(Platform.getMachineDescription().pageSizeInBytes(), in, out, totalNumBytes);
+ }
+
+ /**
+ * Copy the specified input stream to the specified output stream. The total
+ * number of bytes written is returned.
+ *
+ * @param bufferSize the intermediate buffer size, should be {@link MachineDescription#pageSizeInBytes()} for best performance.
+ * @param in the source
+ * @param out the destination
+ * @param totalNumBytes informal number of expected bytes, maybe used for user feedback while processing. -1 if unknown
+ * @return
+ * @throws IOException
+ */
+ public static int copyStream2Stream(int bufferSize, InputStream in, OutputStream out, int totalNumBytes) throws IOException {
+ final byte[] buf = new byte[bufferSize];
int numBytes = 0;
while (true) {
int count;
@@ -181,7 +197,7 @@ public class IOUtil {
}
return numBytes;
}
-
+
/**
* Copy the specified input stream to a byte array, which is being returned.
*/
@@ -281,7 +297,7 @@ public class IOUtil {
* @throws URISyntaxException if path is empty or has no parent directory available while resolving <code>../</code>
*/
public static String slashify(String path, boolean startWithSlash, boolean endWithSlash) throws URISyntaxException {
- String p = path.replace('\\', '/'); // unify file seperator
+ String p = path.replace('\\', '/'); // unify file separator
if (startWithSlash && !p.startsWith("/")) {
p = "/" + p;
}
@@ -297,7 +313,7 @@ public class IOUtil {
* @throws URISyntaxException if the resulting string does not comply w/ an RFC 2396 URI
*/
public static URI toURISimple(File file) throws URISyntaxException {
- return new URI(FILE_SCHEME, null, slashify(file.getAbsolutePath(), true, file.isDirectory()), null);
+ return new URI(FILE_SCHEME, null, encodeToURI(slashify(file.getAbsolutePath(), true, file.isDirectory())), null);
}
/**
@@ -306,7 +322,7 @@ public class IOUtil {
* @throws URISyntaxException if the resulting string does not comply w/ an RFC 2396 URI
*/
public static URI toURISimple(String protocol, String file, boolean isDirectory) throws URISyntaxException {
- return new URI(protocol, null, slashify(file, true, isDirectory), null);
+ return new URI(protocol, null, encodeToURI(slashify(file, true, isDirectory)), null);
}
/**
@@ -429,7 +445,7 @@ public class IOUtil {
* @throws IllegalArgumentException if the URI doesn't match the expected formatting, or is null
* @throws URISyntaxException
*/
- public static URI getDirname(URI uri) throws IllegalArgumentException, URISyntaxException {
+ public static URI getURIDirname(URI uri) throws IllegalArgumentException, URISyntaxException {
if(null == uri) {
throw new IllegalArgumentException("URI is null");
}
@@ -437,6 +453,25 @@ public class IOUtil {
if( DEBUG ) {
System.out.println("getURIDirname "+uri+", extForm: "+uriS);
}
+ return new URI( getURIDirname(uriS) );
+ }
+
+ /**
+ * The URI's <code><i>protocol</i>:/some/path/gluegen-rt.jar</code>
+ * parent dirname URI <code><i>protocol</i>:/some/path/</code> will be returned.
+ * <p>
+ * <i>protocol</i> may be "file", "http", etc..
+ * </p>
+ *
+ * @param uri "<i>protocol</i>:/some/path/gluegen-rt.jar" (URI encoded)
+ * @return "<i>protocol</i>:/some/path/"
+ * @throws IllegalArgumentException if the URI doesn't match the expected formatting, or is null
+ * @throws URISyntaxException
+ */
+ public static String getURIDirname(String uriS) throws IllegalArgumentException, URISyntaxException {
+ if(null == uriS) {
+ throw new IllegalArgumentException("uriS is null");
+ }
// from
// file:/some/path/gluegen-rt.jar _or_ rsrc:gluegen-rt.jar
// to
@@ -446,7 +481,7 @@ public class IOUtil {
// no abs-path, check for protocol terminator ':'
idx = uriS.lastIndexOf(':');
if(0 > idx) {
- throw new IllegalArgumentException("URI does not contain protocol terminator ':', in <"+uri+">");
+ throw new IllegalArgumentException("URI does not contain protocol terminator ':', in <"+uriS+">");
}
}
uriS = uriS.substring(0, idx+1); // exclude jar name, include terminal '/' or ':'
@@ -454,7 +489,7 @@ public class IOUtil {
if( DEBUG ) {
System.out.println("getJarURIDirname res: "+uriS);
}
- return new URI(uriS);
+ return uriS;
}
/**
@@ -479,22 +514,40 @@ public class IOUtil {
* @throws URISyntaxException
*/
public static URL toURL(URI uri) throws IOException, IllegalArgumentException, URISyntaxException {
- final URL url;
+ URL url = null;
final String uriSchema = uri.getScheme();
final boolean isJAR = IOUtil.JAR_SCHEME.equals(uriSchema);
- final URI specificURI = isJAR ? JarUtil.getJarSubURI(uri) : uri;
+ final URI specificURI = isJAR ? JarUtil.getJarSubURI(uri) : uri;
+ int mode = 0;
if( IOUtil.FILE_SCHEME.equals( specificURI.getScheme() ) ) {
- final File f = new File(specificURI);
- if( specificURI == uri ) {
- url = new URL(IOUtil.FILE_SCHEME+IOUtil.SCHEME_SEPARATOR+f.getPath());
- // url = f.toURI().toURL(); // Doesn't work, since it uses encoded path!
- } else {
- final String post = isJAR ? IOUtil.JAR_SCHEME_SEPARATOR + JarUtil.getJarEntry(uri) : "";
- final String urlS = uriSchema+IOUtil.SCHEME_SEPARATOR+IOUtil.FILE_SCHEME+IOUtil.SCHEME_SEPARATOR+f.getPath()+post;
- url = new URL(urlS);
+ File f;
+ try {
+ f = new File(specificURI);
+ } catch( IllegalArgumentException iae) {
+ if( DEBUG ) {
+ System.out.println("toURL: "+uri+" -> File("+specificURI+") failed: "+iae.getMessage());
+ }
+ f = null;
}
- } else {
+ if( null != f ) {
+ if( specificURI == uri ) {
+ url = new URL(IOUtil.FILE_SCHEME+IOUtil.SCHEME_SEPARATOR+f.getPath());
+ // url = f.toURI().toURL(); // Doesn't work, since it uses encoded path!
+ mode = 1;
+ } else {
+ final String post = isJAR ? IOUtil.JAR_SCHEME_SEPARATOR + JarUtil.getJarEntry(uri) : "";
+ final String urlS = uriSchema+IOUtil.SCHEME_SEPARATOR+IOUtil.FILE_SCHEME+IOUtil.SCHEME_SEPARATOR+f.getPath()+post;
+ url = new URL(urlS);
+ mode = 2;
+ }
+ }
+ }
+ if( null == url ) {
url = uri.toURL();
+ mode = 3;
+ }
+ if( DEBUG ) {
+ System.err.println("IOUtil.toURL: "+uri+", isJar "+isJAR+": "+specificURI+" -> mode "+mode+", "+url);
}
return url;
}
@@ -675,7 +728,7 @@ public class IOUtil {
* @throws URISyntaxException if path is empty or has no parent directory available while resolving <code>../</code>
*/
public static URI getRelativeOf(URI baseURI, String relativePath) throws URISyntaxException {
- return compose(baseURI.getScheme(), baseURI.getRawSchemeSpecificPart(), relativePath, baseURI.getRawFragment());
+ return compose(baseURI.getScheme(), baseURI.getSchemeSpecificPart(), encodeToURI(relativePath), baseURI.getFragment());
}
/**
@@ -701,9 +754,11 @@ public class IOUtil {
* </p>
*
* @param scheme scheme of the resulting URI
- * @param schemeSpecificPart may include a query, which is separated while processing
- * @param relativePath denotes a relative file to the baseLocation's parent directory
+ * @param schemeSpecificPart may include a query, which is separated while processing (URI encoded)
+ * @param relativePath denotes a relative file to the baseLocation's parent directory (URI encoded)
+ * @param fragment the URI fragment (URI encoded)
* @throws URISyntaxException if path is empty or has no parent directory available while resolving <code>../</code>
+ * @see #encodeToURI(String)
*/
public static URI compose(String scheme, String schemeSpecificPart, String relativePath, String fragment) throws URISyntaxException {
// cut off optional query in scheme-specific-part
@@ -725,6 +780,26 @@ public class IOUtil {
return new URI(scheme, null == query ? schemeSpecificPart : schemeSpecificPart + "?" + query, fragment);
}
+ private static final Pattern patternSpaceRaw = Pattern.compile(" ");
+ private static final Pattern patternSpaceEnc = Pattern.compile("%20");
+
+ /**
+ * Escapes characters not complying w/ RFC 2396 and the {@link URI#URI(String)} ctor.
+ * <ul>
+ * <li>SPACE -> %20</li>
+ * </ul>
+ */
+ public static String encodeToURI(String s) {
+ return patternSpaceRaw.matcher(s).replaceAll("%20");
+ }
+
+ /**
+ * Reverses escaping of characters as performed via {@link #encodeToURI(String)}.
+ */
+ public static String decodeFromURI(String s) {
+ return patternSpaceEnc.matcher(s).replaceAll(" ");
+ }
+
/**
* Returns the connected URLConnection, or null if not url is not available
*/
diff --git a/src/java/com/jogamp/common/util/JarUtil.java b/src/java/com/jogamp/common/util/JarUtil.java
index 5604c3d..29e7dc7 100644
--- a/src/java/com/jogamp/common/util/JarUtil.java
+++ b/src/java/com/jogamp/common/util/JarUtil.java
@@ -53,6 +53,8 @@ import jogamp.common.Debug;
public class JarUtil {
private static final boolean DEBUG = Debug.debug("JarUtil");
+ private static final int BUFFER_SIZE = 4096;
+
/**
* Interface allowing users to provide an URL resolver that will convert custom classloader
* URLs like Eclipse/OSGi <i>bundleresource:</i> URLs to normal <i>jar:</i> URLs.
@@ -138,8 +140,9 @@ public class JarUtil {
throw new IllegalArgumentException("null arguments: clazzBinName "+clazzBinName+", cl "+cl);
}
final URI uri;
+ final URL url;
{
- final URL url = IOUtil.getClassURL(clazzBinName, cl);
+ url = IOUtil.getClassURL(clazzBinName, cl);
final String scheme = url.getProtocol();
if( null != resolver &&
!scheme.equals( IOUtil.JAR_SCHEME ) &&
@@ -163,6 +166,9 @@ public class JarUtil {
if( !uri.getScheme().equals( IOUtil.JAR_SCHEME ) ) {
throw new IllegalArgumentException("URI is not using scheme "+IOUtil.JAR_SCHEME+": <"+uri+">");
}
+ if(DEBUG) {
+ System.out.println("getJarURI res: "+clazzBinName+" -> "+url+" -> "+uri);
+ }
return uri;
}
@@ -187,7 +193,7 @@ public class JarUtil {
if( !classJarURI.getScheme().equals(IOUtil.JAR_SCHEME) ) {
throw new IllegalArgumentException("URI is not using scheme "+IOUtil.JAR_SCHEME+": <"+classJarURI+">");
}
- String uriS = classJarURI.getRawSchemeSpecificPart();
+ String uriS = classJarURI.getSchemeSpecificPart();
// from
// file:/some/path/gluegen-rt.jar!/com/jogamp/common/util/cache/TempJarCache.class
@@ -264,26 +270,27 @@ public class JarUtil {
if( !classJarURI.getScheme().equals(IOUtil.JAR_SCHEME) ) {
throw new IllegalArgumentException("URI is not a using scheme "+IOUtil.JAR_SCHEME+": <"+classJarURI+">");
}
- String uriS = classJarURI.getRawSchemeSpecificPart();
// from
// file:/some/path/gluegen-rt.jar!/com/jogamp/common/GlueGenVersion.class
// to
// file:/some/path/gluegen-rt.jar
- int idx = uriS.lastIndexOf('!');
+ final String uriS0 = classJarURI.getSchemeSpecificPart();
+ int idx = uriS0.lastIndexOf('!');
+ final String uriS1;
if (0 <= idx) {
- uriS = uriS.substring(0, idx); // exclude '!/'
+ uriS1 = uriS0.substring(0, idx); // exclude '!/'
} else {
throw new IllegalArgumentException("JAR URI does not contain jar uri terminator '!', uri <"+classJarURI+">");
}
-
- if(0 >= uriS.lastIndexOf(".jar")) {
+ if(0 >= uriS1.lastIndexOf(".jar")) {
throw new IllegalArgumentException("No Jar name in <"+classJarURI+">");
- }
+ }
+ final String uriS2 = IOUtil.encodeToURI(uriS1);
if(DEBUG) {
- System.out.println("getJarSubURI res: "+uriS);
+ System.out.println("getJarSubURI res: "+classJarURI+" -> "+uriS0+" -> "+uriS1+" -> "+uriS2);
}
- return new URI(uriS);
+ return new URI(uriS2);
}
/**
@@ -302,7 +309,7 @@ public class JarUtil {
if( !classJarURI.getScheme().equals(IOUtil.JAR_SCHEME) ) {
throw new IllegalArgumentException("URI is not a using scheme "+IOUtil.JAR_SCHEME+": <"+classJarURI+">");
}
- String uriS = classJarURI.getRawSchemeSpecificPart();
+ String uriS = classJarURI.getSchemeSpecificPart();
// from
// file:/some/path/gluegen-rt.jar!/com/jogamp/common/GlueGenVersion.class
@@ -391,6 +398,19 @@ public class JarUtil {
}
/**
+ * @param jarSubUriS file:/some/path/gluegen-rt.jar
+ * @return jar:file:/some/path/gluegen-rt.jar!/
+ * @throws IllegalArgumentException null arguments
+ * @throws URISyntaxException
+ */
+ public static URI getJarFileURI(String jarSubUriS) throws IllegalArgumentException, URISyntaxException {
+ if(null == jarSubUriS) {
+ throw new IllegalArgumentException("jarSubURIS is null");
+ }
+ return new URI(IOUtil.JAR_SCHEME, jarSubUriS+"!/", null);
+ }
+
+ /**
* @param jarFileURI jar:file:/some/path/gluegen-rt.jar!/
* @param jarEntry com/jogamp/common/GlueGenVersion.class
* @return jar:file:/some/path/gluegen-rt.jar!/com/jogamp/common/GlueGenVersion.class
@@ -499,22 +519,23 @@ public class JarUtil {
* @param dest
* @param nativeLibMap
* @param jarFile
- * @param deepDirectoryTraversal
+ * @param nativeLibraryPath if not null, only extracts native libraries within this path.
* @param extractNativeLibraries
* @param extractClassFiles
* @param extractOtherFiles
+ * @param deepDirectoryTraversal
* @return
* @throws IOException
*/
public static final int extract(File dest, Map<String, String> nativeLibMap,
JarFile jarFile,
+ String nativeLibraryPath,
boolean extractNativeLibraries,
- boolean extractClassFiles,
- boolean extractOtherFiles) throws IOException {
+ boolean extractClassFiles, boolean extractOtherFiles) throws IOException {
if (DEBUG) {
System.err.println("JarUtil: extract: "+jarFile.getName()+" -> "+dest+
- ", extractNativeLibraries "+extractNativeLibraries+
+ ", extractNativeLibraries "+extractNativeLibraries+" ("+nativeLibraryPath+")"+
", extractClassFiles "+extractClassFiles+
", extractOtherFiles "+extractOtherFiles);
}
@@ -528,11 +549,29 @@ public class JarUtil {
// Match entries with correct prefix and suffix (ignoring case)
final String libBaseName = NativeLibrary.isValidNativeLibraryName(entryName, false);
final boolean isNativeLib = null != libBaseName;
- if(isNativeLib && !extractNativeLibraries) {
- if (DEBUG) {
- System.err.println("JarUtil: JarEntry : " + entryName + " native-lib skipped");
+ if(isNativeLib) {
+ if(!extractNativeLibraries) {
+ if (DEBUG) {
+ System.err.println("JarUtil: JarEntry : " + entryName + " native-lib skipped, skip all native libs");
+ }
+ continue;
+ }
+ if(null != nativeLibraryPath) {
+ final String nativeLibraryPathS;
+ final String dirnameS;
+ try {
+ nativeLibraryPathS = IOUtil.slashify(nativeLibraryPath, false /* startWithSlash */, true /* endWithSlash */);
+ dirnameS = IOUtil.getDirname(entryName);
+ } catch (URISyntaxException e) {
+ throw new IOException(e);
+ }
+ if( !nativeLibraryPathS.equals(dirnameS) ) {
+ if (DEBUG) {
+ System.err.println("JarUtil: JarEntry : " + entryName + " native-lib skipped, not in path: "+nativeLibraryPathS);
+ }
+ continue;
+ }
}
- continue;
}
final boolean isClassFile = entryName.endsWith(".class");
@@ -566,20 +605,20 @@ public class JarUtil {
if (DEBUG) {
System.err.println("JarUtil: MKDIR: " + entryName + " -> " + destFile );
}
- destFile.mkdir();
+ destFile.mkdirs();
} else {
final File destFolder = new File(destFile.getParent());
if(!destFolder.exists()) {
if (DEBUG) {
System.err.println("JarUtil: MKDIR (parent): " + entryName + " -> " + destFolder );
}
- destFolder.mkdir();
+ destFolder.mkdirs();
}
final InputStream in = new BufferedInputStream(jarFile.getInputStream(entry));
final OutputStream out = new BufferedOutputStream(new FileOutputStream(destFile));
int numBytes = -1;
try {
- numBytes = IOUtil.copyStream2Stream(in, out, -1);
+ numBytes = IOUtil.copyStream2Stream(BUFFER_SIZE, in, out, -1);
} finally {
in.close();
out.close();
diff --git a/src/java/com/jogamp/common/util/PropertyAccess.java b/src/java/com/jogamp/common/util/PropertyAccess.java
index 1a4bc7e..fdb2665 100644
--- a/src/java/com/jogamp/common/util/PropertyAccess.java
+++ b/src/java/com/jogamp/common/util/PropertyAccess.java
@@ -40,12 +40,19 @@ public class PropertyAccess {
public static final String javaws_prefix = "javaws.";
static final HashSet<String> trustedPrefixes;
+ static final HashSet<String> trusted;
static {
trustedPrefixes = new HashSet<String>();
trustedPrefixes.add(javaws_prefix);
trustedPrefixes.add(jnlp_prefix);
// 'jogamp.' and maybe other trusted prefixes will be added later via 'addTrustedPrefix()'
+
+ trusted = new HashSet<String>();
+ trusted.add("sun.java2d.opengl");
+ trusted.add("sun.java2d.noddraw");
+ trusted.add("sun.java2d.d3d");
+ trusted.add("sun.awt.noerasebackground");
}
/**
@@ -60,7 +67,7 @@ public class PropertyAccess {
public static final boolean isTrusted(String propertyKey) {
final int dot1 = propertyKey.indexOf('.');
if(0<=dot1) {
- return trustedPrefixes.contains(propertyKey.substring(0, dot1+1));
+ return trustedPrefixes.contains(propertyKey.substring(0, dot1+1)) || trusted.contains(propertyKey);
} else {
return false;
}
diff --git a/src/java/com/jogamp/common/util/VersionUtil.java b/src/java/com/jogamp/common/util/VersionUtil.java
index 8d9e6a9..8030e94 100644
--- a/src/java/com/jogamp/common/util/VersionUtil.java
+++ b/src/java/com/jogamp/common/util/VersionUtil.java
@@ -55,7 +55,7 @@ public class VersionUtil {
sb.append(SEPERATOR).append(Platform.getNewline());
// environment
- sb.append("Platform: ").append(Platform.getOSType()).append(" / ").append(Platform.getOSName()).append(' ').append(Platform.getOSVersion()).append(" (os), ");
+ sb.append("Platform: ").append(Platform.getOSType()).append(" / ").append(Platform.getOSName()).append(' ').append(Platform.getOSVersion()).append(" (").append(Platform.getOSVersionNumber()).append("), ");
sb.append(Platform.getArchName()).append(" (arch), ").append(Platform.getABIType()).append(", ");
sb.append(Runtime.getRuntime().availableProcessors()).append(" cores");
sb.append(Platform.getNewline());
@@ -68,7 +68,7 @@ public class VersionUtil {
Platform.getMachineDescription().toString(sb).append(Platform.getNewline());
// JVM/JRE
- sb.append("Platform: Java Version: ").append(Platform.getJavaVersion()).append(", VM: ").append(Platform.getJavaVMName());
+ sb.append("Platform: Java Version: ").append(Platform.getJavaVersion()).append(" (").append(Platform.getJavaVersionNumber()).append("u").append(Platform.JAVA_VERSION_UPDATE).append("), VM: ").append(Platform.getJavaVMName());
sb.append(", Runtime: ").append(Platform.getJavaRuntimeName()).append(Platform.getNewline());
sb.append("Platform: Java Vendor: ").append(Platform.getJavaVendor()).append(", ").append(Platform.getJavaVendorURL());
sb.append(", JavaSE: ").append(Platform.isJavaSE());
diff --git a/src/java/com/jogamp/common/util/cache/TempJarCache.java b/src/java/com/jogamp/common/util/cache/TempJarCache.java
index 30dea45..ecf6e56 100644
--- a/src/java/com/jogamp/common/util/cache/TempJarCache.java
+++ b/src/java/com/jogamp/common/util/cache/TempJarCache.java
@@ -27,20 +27,13 @@
*/
package com.jogamp.common.util.cache;
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
import java.io.File;
-import java.io.FileOutputStream;
import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
import java.net.URI;
import java.net.URISyntaxException;
import java.security.cert.Certificate;
-import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
-import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import jogamp.common.Debug;
@@ -204,25 +197,32 @@ public class TempJarCache {
*
* @param certClass if class is certified, the JarFile entries needs to have the same certificate
* @param jarURI
+ * @param nativeLibraryPath if not null, only extracts native libraries within this path.
+ * @return true if native libraries were added or previously loaded from given jarURI, otherwise false
* @throws IOException if the <code>jarURI</code> could not be loaded or a previous load attempt failed
* @throws SecurityException
* @throws URISyntaxException
* @throws IllegalArgumentException
*/
- public synchronized static final void addNativeLibs(Class<?> certClass, URI jarURI) throws IOException, SecurityException, IllegalArgumentException, URISyntaxException {
+ public synchronized static final boolean addNativeLibs(Class<?> certClass, URI jarURI, String nativeLibraryPath) throws IOException, SecurityException, IllegalArgumentException, URISyntaxException {
final LoadState nativeLibJarsLS = nativeLibJars.get(jarURI);
if( !testLoadState(nativeLibJarsLS, LoadState.LOOKED_UP) ) {
nativeLibJars.put(jarURI, LoadState.LOOKED_UP);
final JarFile jarFile = JarUtil.getJarFile(jarURI);
if(DEBUG) {
- System.err.println("TempJarCache: addNativeLibs: "+jarURI+": nativeJar "+jarFile.getName());
+ System.err.println("TempJarCache: addNativeLibs: "+jarURI+": nativeJar "+jarFile.getName()+" (NEW)");
}
validateCertificates(certClass, jarFile);
- JarUtil.extract(tmpFileCache.getTempDir(), nativeLibMap, jarFile, true, false, false);
+ final int num = JarUtil.extract(tmpFileCache.getTempDir(), nativeLibMap, jarFile, nativeLibraryPath, true, false, false);
nativeLibJars.put(jarURI, LoadState.LOADED);
- } else if( !testLoadState(nativeLibJarsLS, LoadState.LOADED) ) {
- throw new IOException("TempJarCache: addNativeLibs: "+jarURI+", previous load attempt failed");
+ return num > 0;
+ } else if( testLoadState(nativeLibJarsLS, LoadState.LOADED) ) {
+ if(DEBUG) {
+ System.err.println("TempJarCache: addNativeLibs: "+jarURI+": nativeJar "+jarURI+" (REUSE)");
+ }
+ return true;
}
+ throw new IOException("TempJarCache: addNativeLibs: "+jarURI+", previous load attempt failed");
}
/**
@@ -248,7 +248,7 @@ public class TempJarCache {
}
validateCertificates(certClass, jarFile);
JarUtil.extract(tmpFileCache.getTempDir(), null, jarFile,
- false, true, false);
+ null /* nativeLibraryPath */, false, true, false);
classFileJars.put(jarURI, LoadState.LOADED);
} else if( !testLoadState(classFileJarsLS, LoadState.LOADED) ) {
throw new IOException("TempJarCache: addClasses: "+jarURI+", previous load attempt failed");
@@ -276,7 +276,7 @@ public class TempJarCache {
}
validateCertificates(certClass, jarFile);
JarUtil.extract(tmpFileCache.getTempDir(), null, jarFile,
- false, false, true);
+ null /* nativeLibraryPath */, false, false, true);
resourceFileJars.put(jarURI, LoadState.LOADED);
} else if( !testLoadState(resourceFileJarsLS, LoadState.LOADED) ) {
throw new IOException("TempJarCache: addResources: "+jarURI+", previous load attempt failed");
@@ -330,7 +330,7 @@ public class TempJarCache {
}
validateCertificates(certClass, jarFile);
JarUtil.extract(tmpFileCache.getTempDir(), nativeLibMap, jarFile,
- extractNativeLibraries, extractClassFiles, extractOtherFiles);
+ null /* nativeLibraryPath */, extractNativeLibraries, extractClassFiles, extractOtherFiles);
// mark loaded (those were just loaded)
if(extractNativeLibraries) {
@@ -397,76 +397,7 @@ public class TempJarCache {
}
return null;
}
-
-
- /**
- * Bootstrapping version extracting the JAR files root entry containing libBaseName,
- * assuming it's a native library. This is used to get the 'gluegen-rt'
- * native library, hence bootstrapping.
- *
- * @param certClass if class is certified, the JarFile entries needs to have the same certificate
- *
- * @throws IOException
- * @throws SecurityException
- * @throws URISyntaxException
- * @throws IllegalArgumentException
- */
- public synchronized static final void bootstrapNativeLib(Class<?> certClass, String libBaseName, URI jarURI)
- throws IOException, SecurityException, IllegalArgumentException, URISyntaxException {
- checkInitialized();
- boolean ok = false;
- int countEntries = 0;
- final LoadState nativeLibJarsLS = nativeLibJars.get(jarURI);
- if( !testLoadState(nativeLibJarsLS, LoadState.LOOKED_UP) && !nativeLibMap.containsKey(libBaseName) ) {
- if(DEBUG) {
- System.err.println("TempJarCache: bootstrapNativeLib(certClass: "+certClass+", libBaseName "+libBaseName+", jarURI "+jarURI+")");
- }
- nativeLibJars.put(jarURI, LoadState.LOOKED_UP);
- final JarFile jarFile = JarUtil.getJarFile(jarURI);
- if(DEBUG) {
- System.err.println("TempJarCache: bootstrapNativeLib: nativeJar "+jarFile.getName());
- }
- validateCertificates(certClass, jarFile);
- final Enumeration<JarEntry> entries = jarFile.entries();
- while (entries.hasMoreElements()) {
- final JarEntry entry = entries.nextElement();
- final String entryName = entry.getName();
-
- if( entryName.indexOf('/') == -1 &&
- entryName.indexOf(File.separatorChar) == -1 &&
- entryName.indexOf(libBaseName) >= 0 )
- {
- final File destFile = new File(tmpFileCache.getTempDir(), entryName);
- final InputStream in = new BufferedInputStream(jarFile.getInputStream(entry));
- final OutputStream out = new BufferedOutputStream(new FileOutputStream(destFile));
- int numBytes = 0;
- try {
- final byte[] buf = new byte[ 2048 ];
- while (true) {
- int countBytes;
- if ((countBytes = in.read(buf)) == -1) { break; }
- out.write(buf, 0, countBytes);
- numBytes += countBytes;
- }
- } finally { in.close(); out.close(); }
- if (numBytes>0) {
- nativeLibMap.put(libBaseName, destFile.getAbsolutePath());
- nativeLibJars.put(jarURI, LoadState.LOADED);
- ok = true;
- countEntries++;
- }
- }
- }
- } else if( testLoadState(nativeLibJarsLS, LoadState.LOADED) ) {
- ok = true; // already loaded
- } else {
- throw new IOException("TempJarCache: bootstrapNativeLib: "+jarURI+", previous load attempt failed");
- }
- if(DEBUG) {
- System.err.println("TempJarCache: bootstrapNativeLib() done, count "+countEntries+", ok "+ok);
- }
- }
-
+
private static void validateCertificates(Class<?> certClass, JarFile jarFile) throws IOException, SecurityException {
if(null == certClass) {
throw new IllegalArgumentException("certClass is null");
diff --git a/src/java/jogamp/common/os/PlatformPropsImpl.java b/src/java/jogamp/common/os/PlatformPropsImpl.java
index 6089cc2..819fe9c 100644
--- a/src/java/jogamp/common/os/PlatformPropsImpl.java
+++ b/src/java/jogamp/common/os/PlatformPropsImpl.java
@@ -44,6 +44,8 @@ public abstract class PlatformPropsImpl {
/** Version 1.6. As a JVM version, it enables certain JVM 1. features. */
public static final VersionNumber Version16;
+ /** Version 1.7. As a JVM version, it enables certain JVM 1.7 features. */
+ public static final VersionNumber Version17;
public static final String OS;
public static final String OS_lower;
@@ -55,6 +57,7 @@ public abstract class PlatformPropsImpl {
public static final String JAVA_VENDOR_URL;
public static final String JAVA_VERSION;
public static final VersionNumber JAVA_VERSION_NUMBER;
+ public static final int JAVA_VERSION_UPDATE;
public static final String JAVA_VM_NAME;
public static final String JAVA_RUNTIME_NAME;
/** True if having {@link java.nio.LongBuffer} and {@link java.nio.DoubleBuffer} available. */
@@ -72,6 +75,7 @@ public abstract class PlatformPropsImpl {
static {
Version16 = new VersionNumber(1, 6, 0);
+ Version17 = new VersionNumber(1, 7, 0);
// We don't seem to need an AccessController.doPrivileged() block
// here as these system properties are visible even to unsigned Applets.
OS = System.getProperty("os.name");
@@ -84,6 +88,17 @@ public abstract class PlatformPropsImpl {
JAVA_VENDOR_URL = System.getProperty("java.vendor.url");
JAVA_VERSION = System.getProperty("java.version");
JAVA_VERSION_NUMBER = new VersionNumber(JAVA_VERSION);
+ {
+ final int usIdx = JAVA_VERSION.lastIndexOf("_");
+ int jvmUpdate = 0;
+ if( usIdx > 0 ) {
+ final String buildS = Platform.JAVA_VERSION.substring(usIdx+1);
+ try {
+ jvmUpdate = Integer.valueOf(buildS);
+ } catch (NumberFormatException nfe) {}
+ }
+ JAVA_VERSION_UPDATE = jvmUpdate;
+ }
JAVA_VM_NAME = System.getProperty("java.vm.name");
JAVA_RUNTIME_NAME = getJavaRuntimeNameImpl();
JAVA_SE = initIsJavaSE();
diff --git a/src/junit/com/jogamp/common/net/AssetURLConnectionRegisteredTest.java b/src/junit/com/jogamp/common/net/AssetURLConnectionRegisteredTest.java
index 2db3fb3..2a3df41 100644
--- a/src/junit/com/jogamp/common/net/AssetURLConnectionRegisteredTest.java
+++ b/src/junit/com/jogamp/common/net/AssetURLConnectionRegisteredTest.java
@@ -12,6 +12,10 @@ import org.junit.Test;
import com.jogamp.common.util.IOUtil;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class AssetURLConnectionRegisteredTest extends AssetURLConnectionBase {
@BeforeClass
diff --git a/src/junit/com/jogamp/common/net/AssetURLConnectionUnregisteredTest.java b/src/junit/com/jogamp/common/net/AssetURLConnectionUnregisteredTest.java
index be32c98..29b698e 100644
--- a/src/junit/com/jogamp/common/net/AssetURLConnectionUnregisteredTest.java
+++ b/src/junit/com/jogamp/common/net/AssetURLConnectionUnregisteredTest.java
@@ -11,6 +11,10 @@ import org.junit.Test;
import com.jogamp.common.util.IOUtil;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class AssetURLConnectionUnregisteredTest extends AssetURLConnectionBase {
@Test
public void assetUnregisteredURLConnection_RT2() throws IOException {
diff --git a/src/junit/com/jogamp/common/net/URLCompositionTest.java b/src/junit/com/jogamp/common/net/URLCompositionTest.java
index 5d19c1d..3083fbd 100644
--- a/src/junit/com/jogamp/common/net/URLCompositionTest.java
+++ b/src/junit/com/jogamp/common/net/URLCompositionTest.java
@@ -14,6 +14,10 @@ import org.junit.Test;
import com.jogamp.common.util.IOUtil;
import com.jogamp.junit.util.JunitTracer;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class URLCompositionTest extends JunitTracer {
@BeforeClass
@@ -204,6 +208,32 @@ public class URLCompositionTest extends JunitTracer {
Assert.assertTrue(refURL.sameFile(uri2.toURL()));
}
+ @Test
+ public void testURLProps() throws IOException, URISyntaxException {
+ final String SCHEME = "camera";
+ final String HOST = "somewhere";
+ final String PATH = "0";
+ String[] args = new String[] {
+ SCHEME+"://"+HOST+"/"+PATH,
+ SCHEME+"://"+HOST+"/"+PATH+"?p1=1",
+ };
+ for(int i=0; i<args.length-1; i+=2) {
+ String uri_s0 = args[i];
+ String uri_s1 = args[i+1];
+ URI uri0 = new URI(uri_s0);
+ URI uri1 = new URI(uri_s1);
+ showURI(uri0);
+ showURI(uri1);
+ URIQueryProps data = URIQueryProps.create(uri1, ';');
+ if(null == data) {
+ System.err.println("Error: NULL: <"+uri_s1+"> -> "+uri1+" -> NULL");
+ } else {
+ URI uri1T = data.appendQuery(uri0);
+ showURI(uri1T);
+ Assert.assertEquals(uri1, uri1T);
+ }
+ }
+ }
public static void main(String args[]) throws IOException {
String tstname = URLCompositionTest.class.getName();
org.junit.runner.JUnitCore.main(tstname);
diff --git a/src/junit/com/jogamp/common/nio/BuffersTest.java b/src/junit/com/jogamp/common/nio/BuffersTest.java
index 02c246f..9ad7823 100644
--- a/src/junit/com/jogamp/common/nio/BuffersTest.java
+++ b/src/junit/com/jogamp/common/nio/BuffersTest.java
@@ -41,6 +41,10 @@ import static org.junit.Assert.*;
/**
* @author Michael Bien
*/
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class BuffersTest extends JunitTracer {
@Test
diff --git a/src/junit/com/jogamp/common/nio/CachedBufferFactoryTest.java b/src/junit/com/jogamp/common/nio/CachedBufferFactoryTest.java
index 326b4cf..b0cd49e 100644
--- a/src/junit/com/jogamp/common/nio/CachedBufferFactoryTest.java
+++ b/src/junit/com/jogamp/common/nio/CachedBufferFactoryTest.java
@@ -51,6 +51,10 @@ import static org.junit.Assert.*;
*
* @author Michael Bien
*/
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class CachedBufferFactoryTest extends JunitTracer {
private final int BUFFERCOUNT = 120;
diff --git a/src/junit/com/jogamp/common/nio/TestBuffersFloatDoubleConversion.java b/src/junit/com/jogamp/common/nio/TestBuffersFloatDoubleConversion.java
index 439ff08..192a49e 100644
--- a/src/junit/com/jogamp/common/nio/TestBuffersFloatDoubleConversion.java
+++ b/src/junit/com/jogamp/common/nio/TestBuffersFloatDoubleConversion.java
@@ -35,6 +35,10 @@ import org.junit.Test;
import com.jogamp.junit.util.JunitTracer;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestBuffersFloatDoubleConversion extends JunitTracer {
public static boolean cmpFloatArray(float[] d1, int d1_offset, float[] d2, int d2_offset, int len) {
diff --git a/src/junit/com/jogamp/common/nio/TestPointerBufferEndian.java b/src/junit/com/jogamp/common/nio/TestPointerBufferEndian.java
index c40d1d3..3a1c584 100644
--- a/src/junit/com/jogamp/common/nio/TestPointerBufferEndian.java
+++ b/src/junit/com/jogamp/common/nio/TestPointerBufferEndian.java
@@ -11,6 +11,10 @@ import org.junit.Test;
import static java.lang.System.*;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestPointerBufferEndian extends JunitTracer {
protected void testImpl (boolean direct) {
diff --git a/src/junit/com/jogamp/common/nio/TestStructAccessorEndian.java b/src/junit/com/jogamp/common/nio/TestStructAccessorEndian.java
index 6d8ed88..62eccf0 100644
--- a/src/junit/com/jogamp/common/nio/TestStructAccessorEndian.java
+++ b/src/junit/com/jogamp/common/nio/TestStructAccessorEndian.java
@@ -12,6 +12,10 @@ import com.jogamp.common.os.MachineDescription;
import com.jogamp.common.os.Platform;
import com.jogamp.junit.util.JunitTracer;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestStructAccessorEndian extends JunitTracer {
@Test
diff --git a/src/junit/com/jogamp/common/os/TestElfReader01.java b/src/junit/com/jogamp/common/os/TestElfReader01.java
index 3993fc4..b058a0f 100644
--- a/src/junit/com/jogamp/common/os/TestElfReader01.java
+++ b/src/junit/com/jogamp/common/os/TestElfReader01.java
@@ -18,6 +18,10 @@ import org.junit.Test;
import com.jogamp.common.os.Platform.OSType;
import com.jogamp.junit.util.JunitTracer;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestElfReader01 extends JunitTracer {
public static String GNU_LINUX_SELF_EXE = "/proc/self/exe";
public static String ARM_HF_EXE = "tst-exe-armhf";
diff --git a/src/junit/com/jogamp/common/util/IntIntHashMapTest.java b/src/junit/com/jogamp/common/util/IntIntHashMapTest.java
index ab348a3..fa56d3d 100644
--- a/src/junit/com/jogamp/common/util/IntIntHashMapTest.java
+++ b/src/junit/com/jogamp/common/util/IntIntHashMapTest.java
@@ -48,6 +48,10 @@ import static java.lang.System.*;
* @author Michael Bien
* @author Sven Gothel
*/
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class IntIntHashMapTest {
private static int iterations;
diff --git a/src/junit/com/jogamp/common/util/IntObjectHashMapTest.java b/src/junit/com/jogamp/common/util/IntObjectHashMapTest.java
index d0429e8..18cdf6c 100644
--- a/src/junit/com/jogamp/common/util/IntObjectHashMapTest.java
+++ b/src/junit/com/jogamp/common/util/IntObjectHashMapTest.java
@@ -47,6 +47,10 @@ import static org.junit.Assert.*;
* @author Michael Bien
* @author Sven Gothel
*/
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class IntObjectHashMapTest {
private static int iterations;
diff --git a/src/junit/com/jogamp/common/util/LongIntHashMapTest.java b/src/junit/com/jogamp/common/util/LongIntHashMapTest.java
index 9558065..ac1f7c4 100644
--- a/src/junit/com/jogamp/common/util/LongIntHashMapTest.java
+++ b/src/junit/com/jogamp/common/util/LongIntHashMapTest.java
@@ -48,6 +48,10 @@ import static java.lang.System.*;
* @author Michael Bien
* @author Simon Goller
*/
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class LongIntHashMapTest {
private static int iterations;
diff --git a/src/junit/com/jogamp/common/util/TestArrayHashSet01.java b/src/junit/com/jogamp/common/util/TestArrayHashSet01.java
index 1e1c281..10a4bf1 100644
--- a/src/junit/com/jogamp/common/util/TestArrayHashSet01.java
+++ b/src/junit/com/jogamp/common/util/TestArrayHashSet01.java
@@ -36,6 +36,10 @@ import org.junit.Test;
import com.jogamp.junit.util.JunitTracer;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestArrayHashSet01 extends JunitTracer {
public static class Dummy {
diff --git a/src/junit/com/jogamp/common/util/TestFloatStack01.java b/src/junit/com/jogamp/common/util/TestFloatStack01.java
index 90ac2e0..eab83aa 100644
--- a/src/junit/com/jogamp/common/util/TestFloatStack01.java
+++ b/src/junit/com/jogamp/common/util/TestFloatStack01.java
@@ -37,6 +37,10 @@ import org.junit.Test;
import com.jogamp.junit.util.JunitTracer;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class /*testname*/TestFloatStack01/*testname*/ extends JunitTracer {
static final boolean equals(/*value*/float/*value*/[] b, int bOffset,
diff --git a/src/junit/com/jogamp/common/util/TestIOUtil01.java b/src/junit/com/jogamp/common/util/TestIOUtil01.java
index b75127c..6a53bb5 100644
--- a/src/junit/com/jogamp/common/util/TestIOUtil01.java
+++ b/src/junit/com/jogamp/common/util/TestIOUtil01.java
@@ -46,6 +46,10 @@ import com.jogamp.common.os.MachineDescription;
import com.jogamp.common.os.Platform;
import com.jogamp.junit.util.JunitTracer;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestIOUtil01 extends JunitTracer {
static final MachineDescription machine = Platform.getMachineDescription();
diff --git a/src/junit/com/jogamp/common/util/TestIteratorIndexCORE.java b/src/junit/com/jogamp/common/util/TestIteratorIndexCORE.java
index cb142a3..0ffed92 100644
--- a/src/junit/com/jogamp/common/util/TestIteratorIndexCORE.java
+++ b/src/junit/com/jogamp/common/util/TestIteratorIndexCORE.java
@@ -40,6 +40,10 @@ import org.junit.Test;
import com.jogamp.common.os.Platform;
import com.jogamp.junit.util.JunitTracer;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestIteratorIndexCORE extends JunitTracer {
static int elems = 10;
diff --git a/src/junit/com/jogamp/common/util/TestJarUtil.java b/src/junit/com/jogamp/common/util/TestJarUtil.java
index fa45853..18fcaa7 100644
--- a/src/junit/com/jogamp/common/util/TestJarUtil.java
+++ b/src/junit/com/jogamp/common/util/TestJarUtil.java
@@ -53,6 +53,10 @@ import com.jogamp.common.util.cache.TempFileCache;
import com.jogamp.common.util.cache.TempJarCache;
import com.jogamp.junit.util.JunitTracer;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestJarUtil extends JunitTracer {
static TempFileCache fileCache;
diff --git a/src/junit/com/jogamp/common/util/TestLFRingBuffer01.java b/src/junit/com/jogamp/common/util/TestLFRingBuffer01.java
index bcfeb11..1695b37 100644
--- a/src/junit/com/jogamp/common/util/TestLFRingBuffer01.java
+++ b/src/junit/com/jogamp/common/util/TestLFRingBuffer01.java
@@ -31,6 +31,10 @@ package com.jogamp.common.util;
import com.jogamp.common.util.LFRingbuffer;
import com.jogamp.common.util.Ringbuffer;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestLFRingBuffer01 extends RingBuffer01Base {
public Ringbuffer<Integer> createEmpty(int initialCapacity) {
return new LFRingbuffer<Integer>(Integer[].class, initialCapacity);
diff --git a/src/junit/com/jogamp/common/util/TestPlatform01.java b/src/junit/com/jogamp/common/util/TestPlatform01.java
index 8c0fd46..c2218da 100644
--- a/src/junit/com/jogamp/common/util/TestPlatform01.java
+++ b/src/junit/com/jogamp/common/util/TestPlatform01.java
@@ -35,6 +35,10 @@ import com.jogamp.common.os.MachineDescription;
import com.jogamp.common.os.Platform;
import com.jogamp.junit.util.JunitTracer;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestPlatform01 extends JunitTracer {
@Test
diff --git a/src/junit/com/jogamp/common/util/TestRunnableTask01.java b/src/junit/com/jogamp/common/util/TestRunnableTask01.java
index 6274294..6051a9b 100644
--- a/src/junit/com/jogamp/common/util/TestRunnableTask01.java
+++ b/src/junit/com/jogamp/common/util/TestRunnableTask01.java
@@ -36,6 +36,10 @@ import org.junit.Test;
import com.jogamp.junit.util.JunitTracer;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestRunnableTask01 extends JunitTracer {
@Test
diff --git a/src/junit/com/jogamp/common/util/TestSyncRingBuffer01.java b/src/junit/com/jogamp/common/util/TestSyncRingBuffer01.java
index b598f15..0418d44 100644
--- a/src/junit/com/jogamp/common/util/TestSyncRingBuffer01.java
+++ b/src/junit/com/jogamp/common/util/TestSyncRingBuffer01.java
@@ -31,6 +31,10 @@ package com.jogamp.common.util;
import com.jogamp.common.util.Ringbuffer;
import com.jogamp.common.util.SyncedRingbuffer;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestSyncRingBuffer01 extends RingBuffer01Base {
public Ringbuffer<Integer> createEmpty(int initialCapacity) {
return new SyncedRingbuffer<Integer>(Integer[].class, initialCapacity);
diff --git a/src/junit/com/jogamp/common/util/TestSystemPropsAndEnvs.java b/src/junit/com/jogamp/common/util/TestSystemPropsAndEnvs.java
index b182a6f..cb8acb1 100644
--- a/src/junit/com/jogamp/common/util/TestSystemPropsAndEnvs.java
+++ b/src/junit/com/jogamp/common/util/TestSystemPropsAndEnvs.java
@@ -37,6 +37,10 @@ import org.junit.Test;
import com.jogamp.junit.util.JunitTracer;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestSystemPropsAndEnvs extends JunitTracer {
@Test
diff --git a/src/junit/com/jogamp/common/util/TestTempJarCache.java b/src/junit/com/jogamp/common/util/TestTempJarCache.java
index 62a916a..7ddf52a 100644
--- a/src/junit/com/jogamp/common/util/TestTempJarCache.java
+++ b/src/junit/com/jogamp/common/util/TestTempJarCache.java
@@ -29,6 +29,7 @@
package com.jogamp.common.util;
import java.io.File;
+
import java.io.IOException;
import java.lang.reflect.Method;
import java.net.URI;
@@ -40,7 +41,9 @@ import java.util.jar.JarFile;
import junit.framework.Assert;
import org.junit.BeforeClass;
+import org.junit.FixMethodOrder;
import org.junit.Test;
+import org.junit.runners.MethodSorters;
import com.jogamp.common.GlueGenVersion;
import com.jogamp.common.jvm.JNILibLoaderBase;
@@ -52,6 +55,7 @@ import com.jogamp.common.util.cache.TempFileCache;
import com.jogamp.common.util.cache.TempJarCache;
import com.jogamp.junit.util.JunitTracer;
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestTempJarCache extends JunitTracer {
static TempFileCache fileCache;
@@ -143,7 +147,7 @@ public class TestTempJarCache extends JunitTracer {
if(AndroidVersion.isAvailable) { System.err.println("n/a on Android"); return; }
JarFile jarFile = JarUtil.getJarFile(GlueGenVersion.class.getName(), this.getClass().getClassLoader());
Assert.assertNotNull(jarFile);
- JarUtil.extract(fileCache.getTempDir(), null, jarFile, false, true, true);
+ JarUtil.extract(fileCache.getTempDir(), null, jarFile, null, false, true, true);
File f = new File(fileCache.getTempDir(), "META-INF/MANIFEST.MF");
Assert.assertTrue(f.exists());
f = new File(fileCache.getTempDir(), IOUtil.getClassFileName(GlueGenVersion.class.getName()));
@@ -199,11 +203,11 @@ public class TestTempJarCache extends JunitTracer {
final ClassLoader cl = getClass().getClassLoader();
URI jarUriRoot = JarUtil.getJarSubURI(TempJarCache.class.getName(), cl);
- jarUriRoot = IOUtil.getDirname(jarUriRoot);
+ jarUriRoot = IOUtil.getURIDirname(jarUriRoot);
URI nativeJarURI = JarUtil.getJarFileURI(jarUriRoot, nativeJarName);
- TempJarCache.addNativeLibs(TempJarCache.class, nativeJarURI);
+ TempJarCache.addNativeLibs(TempJarCache.class, nativeJarURI, null /* nativeLibraryPath */);
String libFullPath = TempJarCache.findLibrary(libBaseName);
Assert.assertNotNull(libFullPath);
Assert.assertEquals(libBaseName, NativeLibrary.isValidNativeLibraryName(libFullPath, true));
diff --git a/src/junit/com/jogamp/common/util/TestValueConversion.java b/src/junit/com/jogamp/common/util/TestValueConversion.java
index 2a437b8..b70a414 100644
--- a/src/junit/com/jogamp/common/util/TestValueConversion.java
+++ b/src/junit/com/jogamp/common/util/TestValueConversion.java
@@ -37,6 +37,10 @@ import static com.jogamp.common.util.ValueConv.*;
/**
* Testing ValueConv's value conversion of primitive types
*/
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestValueConversion {
@Test
diff --git a/src/junit/com/jogamp/common/util/TestVersionInfo.java b/src/junit/com/jogamp/common/util/TestVersionInfo.java
index f9c748b..46bd1d2 100644
--- a/src/junit/com/jogamp/common/util/TestVersionInfo.java
+++ b/src/junit/com/jogamp/common/util/TestVersionInfo.java
@@ -34,6 +34,10 @@ import org.junit.Test;
import com.jogamp.common.GlueGenVersion;
import com.jogamp.junit.util.JunitTracer;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestVersionInfo extends JunitTracer {
@Test
diff --git a/src/junit/com/jogamp/common/util/TestVersionNumber.java b/src/junit/com/jogamp/common/util/TestVersionNumber.java
index e46213a..b3d1cfd 100644
--- a/src/junit/com/jogamp/common/util/TestVersionNumber.java
+++ b/src/junit/com/jogamp/common/util/TestVersionNumber.java
@@ -35,6 +35,10 @@ import org.junit.Test;
import com.jogamp.junit.util.JunitTracer;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestVersionNumber extends JunitTracer {
@Test
diff --git a/src/junit/com/jogamp/common/util/locks/TestRecursiveLock01.java b/src/junit/com/jogamp/common/util/locks/TestRecursiveLock01.java
index 45df7b2..df5f3ba 100644
--- a/src/junit/com/jogamp/common/util/locks/TestRecursiveLock01.java
+++ b/src/junit/com/jogamp/common/util/locks/TestRecursiveLock01.java
@@ -40,6 +40,10 @@ import org.junit.Test;
import com.jogamp.common.os.Platform;
import com.jogamp.junit.util.JunitTracer;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestRecursiveLock01 extends JunitTracer {
public enum YieldMode {
diff --git a/src/junit/com/jogamp/common/util/locks/TestRecursiveThreadGroupLock01.java b/src/junit/com/jogamp/common/util/locks/TestRecursiveThreadGroupLock01.java
index 7191a74..51cc0ac 100644
--- a/src/junit/com/jogamp/common/util/locks/TestRecursiveThreadGroupLock01.java
+++ b/src/junit/com/jogamp/common/util/locks/TestRecursiveThreadGroupLock01.java
@@ -36,6 +36,10 @@ import org.junit.Test;
import com.jogamp.common.os.Platform;
import com.jogamp.junit.util.JunitTracer;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestRecursiveThreadGroupLock01 extends JunitTracer {
public enum YieldMode {
diff --git a/src/junit/com/jogamp/common/util/locks/TestSingletonServerSocket00.java b/src/junit/com/jogamp/common/util/locks/TestSingletonServerSocket00.java
index bb6a55c..2ab6d52 100644
--- a/src/junit/com/jogamp/common/util/locks/TestSingletonServerSocket00.java
+++ b/src/junit/com/jogamp/common/util/locks/TestSingletonServerSocket00.java
@@ -34,6 +34,10 @@ import junit.framework.Assert;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestSingletonServerSocket00 {
// public static final String SINGLE_INSTANCE_LOCK_FILE = "UITestCase.lock";
public static final int SINGLE_INSTANCE_LOCK_PORT = 59999;
diff --git a/src/junit/com/jogamp/common/util/locks/TestSingletonServerSocket01.java b/src/junit/com/jogamp/common/util/locks/TestSingletonServerSocket01.java
index 9acd7d6..6cb5d39 100644
--- a/src/junit/com/jogamp/common/util/locks/TestSingletonServerSocket01.java
+++ b/src/junit/com/jogamp/common/util/locks/TestSingletonServerSocket01.java
@@ -35,6 +35,10 @@ import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestSingletonServerSocket01 {
// public static final String SINGLE_INSTANCE_LOCK_FILE = "UITestCase.lock";
public static final int SINGLE_INSTANCE_LOCK_PORT = 59999;
diff --git a/src/junit/com/jogamp/common/util/locks/TestSingletonServerSocket02.java b/src/junit/com/jogamp/common/util/locks/TestSingletonServerSocket02.java
index 69128d1..32a1c00 100644
--- a/src/junit/com/jogamp/common/util/locks/TestSingletonServerSocket02.java
+++ b/src/junit/com/jogamp/common/util/locks/TestSingletonServerSocket02.java
@@ -35,6 +35,10 @@ import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestSingletonServerSocket02 {
// public static final String SINGLE_INSTANCE_LOCK_FILE = "UITestCase.lock";
public static final int SINGLE_INSTANCE_LOCK_PORT = 59999;
diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/PCPPTest.java b/src/junit/com/jogamp/gluegen/test/junit/generation/PCPPTest.java
index 4c47a78..eceef19 100644
--- a/src/junit/com/jogamp/gluegen/test/junit/generation/PCPPTest.java
+++ b/src/junit/com/jogamp/gluegen/test/junit/generation/PCPPTest.java
@@ -47,6 +47,10 @@ import static org.junit.Assert.*;
* serves mainly as entry point for debugging purposes.
* @author Sven Gothel, Michael Bien
*/
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class PCPPTest extends JunitTracer {
@BeforeClass
diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p1JavaEmitter.java b/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p1JavaEmitter.java
index 60159be..bbf0398 100644
--- a/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p1JavaEmitter.java
+++ b/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p1JavaEmitter.java
@@ -40,6 +40,10 @@ import org.junit.Test;
* @author Michael Bien
* @author Sven Gothel
*/
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class Test1p1JavaEmitter extends BaseClass {
/**
diff --git a/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p2ProcAddressEmitter.java b/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p2ProcAddressEmitter.java
index 64f17a5..a11489c 100644
--- a/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p2ProcAddressEmitter.java
+++ b/src/junit/com/jogamp/gluegen/test/junit/generation/Test1p2ProcAddressEmitter.java
@@ -43,6 +43,10 @@ import org.junit.Test;
* @author Michael Bien
* @author Sven Gothel
*/
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class Test1p2ProcAddressEmitter extends BaseClass {
static NativeLibrary dynamicLookupHelper;
diff --git a/src/junit/com/jogamp/gluegen/test/junit/structgen/TestStructGen01.java b/src/junit/com/jogamp/gluegen/test/junit/structgen/TestStructGen01.java
index 444593d..23b1624 100644
--- a/src/junit/com/jogamp/gluegen/test/junit/structgen/TestStructGen01.java
+++ b/src/junit/com/jogamp/gluegen/test/junit/structgen/TestStructGen01.java
@@ -6,6 +6,10 @@ import com.jogamp.junit.util.JunitTracer;
import org.junit.Assert;
import org.junit.Test;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestStructGen01 extends JunitTracer {
// APT is only triggered for fields,
diff --git a/src/junit/com/jogamp/junit/sec/TestSecIOUtil01.java b/src/junit/com/jogamp/junit/sec/TestSecIOUtil01.java
index 306e8d8..cc734ec 100644
--- a/src/junit/com/jogamp/junit/sec/TestSecIOUtil01.java
+++ b/src/junit/com/jogamp/junit/sec/TestSecIOUtil01.java
@@ -45,6 +45,10 @@ import com.jogamp.common.util.IOUtil;
import com.jogamp.common.util.JarUtil;
import com.jogamp.junit.util.JunitTracer;
+import org.junit.FixMethodOrder;
+import org.junit.runners.MethodSorters;
+
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class TestSecIOUtil01 extends JunitTracer {
static final String java_io_tmpdir_propkey = "java.io.tmpdir";
static final String java_home_propkey = "java.home";
diff --git a/src/junit/com/jogamp/junit/util/JunitTracer.java b/src/junit/com/jogamp/junit/util/JunitTracer.java
index befc2ad..555f27f 100644
--- a/src/junit/com/jogamp/junit/util/JunitTracer.java
+++ b/src/junit/com/jogamp/junit/util/JunitTracer.java
@@ -33,10 +33,13 @@ import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.After;
import org.junit.AfterClass;
+import org.junit.FixMethodOrder;
import org.junit.Rule;
import org.junit.rules.TestName;
+import org.junit.runners.MethodSorters;
+@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public abstract class JunitTracer {
@Rule public TestName _unitTestName = new TestName();