summaryrefslogtreecommitdiffstats
path: root/src/java/com/jogamp/common/util/JarUtil.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-10-01 23:03:18 +0200
committerSven Gothel <[email protected]>2013-10-01 23:03:18 +0200
commitca7a1864a1624539048809d0a1c491f57c145d15 (patch)
treec2fcc0d522fe4ca6561cc31c31a7ed8e5a1c8238 /src/java/com/jogamp/common/util/JarUtil.java
parent3c9812c130fac9237a2dc2e18a6639ec3583eed7 (diff)
IOUtil/JarUtil: Add more detail debug information for URI transformation; IOUtil.toURL(..) handle exception at 'new File(uri)'
Diffstat (limited to 'src/java/com/jogamp/common/util/JarUtil.java')
-rw-r--r--src/java/com/jogamp/common/util/JarUtil.java19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/java/com/jogamp/common/util/JarUtil.java b/src/java/com/jogamp/common/util/JarUtil.java
index 665e196..481fe92 100644
--- a/src/java/com/jogamp/common/util/JarUtil.java
+++ b/src/java/com/jogamp/common/util/JarUtil.java
@@ -140,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 ) &&
@@ -165,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;
}
@@ -266,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.getRawSchemeSpecificPart();
+ 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+">");
}
if(DEBUG) {
- System.out.println("getJarSubURI res: "+uriS);
+ System.out.println("getJarSubURI res: "+classJarURI+" -> "+uriS0+" -> "+uriS1+" -> "+uriS1);
}
- return new URI(uriS);
+ return new URI(uriS1);
}
/**