diff options
author | Sven Gothel <[email protected]> | 2013-10-07 01:06:42 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2013-10-07 01:06:42 +0200 |
commit | 41fce94f95448bbea110a455ea508740fac8d8c9 (patch) | |
tree | 5ca6e6e004c27397ddb2a50f0959f05b53c7cca6 /src/java/com/jogamp/common/util/JarUtil.java | |
parent | 0dc49ba20f889a0e5ef3de3d750c39f82f464fc1 (diff) |
Bug 820: Escape SPACE in filenames for URI ctor, use decoded URI components when compiling new URI.
Add IOUtil:
- String encodeToURI(String)
- String decodeFromURI(String)
Both only handle escaping of SPACE only. Determine whether other chars need to be treated.
Diffstat (limited to 'src/java/com/jogamp/common/util/JarUtil.java')
-rw-r--r-- | src/java/com/jogamp/common/util/JarUtil.java | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/java/com/jogamp/common/util/JarUtil.java b/src/java/com/jogamp/common/util/JarUtil.java index 481fe92..29e7dc7 100644 --- a/src/java/com/jogamp/common/util/JarUtil.java +++ b/src/java/com/jogamp/common/util/JarUtil.java @@ -193,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 @@ -275,7 +275,7 @@ public class JarUtil { // file:/some/path/gluegen-rt.jar!/com/jogamp/common/GlueGenVersion.class // to // file:/some/path/gluegen-rt.jar - final String uriS0 = classJarURI.getRawSchemeSpecificPart(); + final String uriS0 = classJarURI.getSchemeSpecificPart(); int idx = uriS0.lastIndexOf('!'); final String uriS1; if (0 <= idx) { @@ -283,14 +283,14 @@ public class JarUtil { } else { throw new IllegalArgumentException("JAR URI does not contain jar uri terminator '!', uri <"+classJarURI+">"); } - 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: "+classJarURI+" -> "+uriS0+" -> "+uriS1+" -> "+uriS1); + System.out.println("getJarSubURI res: "+classJarURI+" -> "+uriS0+" -> "+uriS1+" -> "+uriS2); } - return new URI(uriS1); + return new URI(uriS2); } /** @@ -309,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 |