summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-11-27 21:46:15 +0100
committerSven Gothel <[email protected]>2013-11-27 21:46:15 +0100
commite9aae0ace6780af5f65e01001324832d56ed592f (patch)
treef583a321d76d21049e249574010513555bed935e
parentbd72d40781caf40c2148cdc7990218af44750c76 (diff)
JARUtil/IOUtil: Reuse IOUtil.JAR_SCHEME_SEPARATOR (now a char); Add DEBUG to JarUtil.getJarEntry(..)
-rw-r--r--src/java/com/jogamp/common/util/IOUtil.java2
-rw-r--r--src/java/com/jogamp/common/util/JarUtil.java17
2 files changed, 12 insertions, 7 deletions
diff --git a/src/java/com/jogamp/common/util/IOUtil.java b/src/java/com/jogamp/common/util/IOUtil.java
index 15fb5ab..c719310 100644
--- a/src/java/com/jogamp/common/util/IOUtil.java
+++ b/src/java/com/jogamp/common/util/IOUtil.java
@@ -68,7 +68,7 @@ public class IOUtil {
/** {@value} */
public static final String JAR_SCHEME = "jar";
/** A JAR subprotocol is separeted from the JAR entry w/ this separator {@value}. Even if no class is specified '!/' must follow!. */
- public static final String JAR_SCHEME_SEPARATOR = "!";
+ public static final char JAR_SCHEME_SEPARATOR = '!';
/** Std. temporary directory property key <code>java.io.tmpdir</code>. */
private static final String java_io_tmpdir_propkey = "java.io.tmpdir";
diff --git a/src/java/com/jogamp/common/util/JarUtil.java b/src/java/com/jogamp/common/util/JarUtil.java
index ac93427..d22d441 100644
--- a/src/java/com/jogamp/common/util/JarUtil.java
+++ b/src/java/com/jogamp/common/util/JarUtil.java
@@ -200,7 +200,7 @@ public class JarUtil {
// file:/some/path/gluegen-rt.jar!/com/jogamp/common/util/cache/TempJarCache.class
// to
// file:/some/path/gluegen-rt.jar
- int idx = uriS.lastIndexOf('!');
+ int idx = uriS.lastIndexOf(IOUtil.JAR_SCHEME_SEPARATOR);
if (0 <= idx) {
uriS = uriS.substring(0, idx); // exclude '!/'
} else {
@@ -277,7 +277,7 @@ public class JarUtil {
// to
// file:/some/path/gluegen-rt.jar
final String uriS0 = classJarURI.getSchemeSpecificPart();
- int idx = uriS0.lastIndexOf('!');
+ int idx = uriS0.lastIndexOf(IOUtil.JAR_SCHEME_SEPARATOR);
final String uriS1;
if (0 <= idx) {
uriS1 = uriS0.substring(0, idx); // exclude '!/'
@@ -310,15 +310,20 @@ 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.getSchemeSpecificPart();
+ // final String uriS = classJarURI.toString(); // getSchemeSpecificPart(); ignore fragment !
+ final String uriS = classJarURI.getSchemeSpecificPart();
// from
// file:/some/path/gluegen-rt.jar!/com/jogamp/common/GlueGenVersion.class
// to
- // file:/some/path/gluegen-rt.jar
- int idx = uriS.lastIndexOf('!');
+ // /com/jogamp/common/GlueGenVersion.class
+ final int idx = uriS.lastIndexOf(IOUtil.JAR_SCHEME_SEPARATOR);
if (0 <= idx) {
- return uriS.substring(idx+1); // right of '!'
+ final String res = uriS.substring(idx+1); // right of '!'
+ if(DEBUG) {
+ System.err.println("getJarEntry res: "+classJarURI+" -> "+uriS+" -> "+idx+" -> "+res);
+ }
+ return res;
} else {
throw new IllegalArgumentException("JAR URI does not contain jar uri terminator '!', uri <"+classJarURI+">");
}