summaryrefslogtreecommitdiffstats
path: root/src/junit/com/jogamp/common/util
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2013-06-19 04:44:14 +0200
committerSven Gothel <[email protected]>2013-06-19 04:44:14 +0200
commit4376174ad35fdaf76f59430328582e913f468674 (patch)
treeeb1faa41eb440b1fec0c5f9932007050e5bd7e8b /src/junit/com/jogamp/common/util
parent88dca02541d96f68a892ae7824e9e1b29793ae55 (diff)
Fix Bug 757: Regression of URL to URI conversion (Encoded path not compatible w/ file scheme.
Regression of (Bug 683, Commit b98825eb7cfb61aead4a7dff57471cd2d2c26823). The URI encoded path cannot be read by File I/O (if file scheme), since the latter requests an UTF8/16 name, not an URI encoded name (i.e. %20 for space). The encoded URL is produced if calling 'uri.toURL()' and hence the new 'IOUtil.toURL(URI)' provides a custom conversion recovering the UTF name via 'new File(uri).getPath()'. Tested w/ - synthetic URI/URL coposition (unit test) - manual w/ moving 'build' to 'build öä lala' for gluegen, joal and jogl. +++ Misc.: - 'URI JarUtil.getURIDirname(URI)' -> 'URI IOUtil.getDirname(URI)' ++
Diffstat (limited to 'src/junit/com/jogamp/common/util')
-rw-r--r--src/junit/com/jogamp/common/util/TestJarUtil.java16
-rw-r--r--src/junit/com/jogamp/common/util/TestTempJarCache.java2
2 files changed, 10 insertions, 8 deletions
diff --git a/src/junit/com/jogamp/common/util/TestJarUtil.java b/src/junit/com/jogamp/common/util/TestJarUtil.java
index ab78556..fa45853 100644
--- a/src/junit/com/jogamp/common/util/TestJarUtil.java
+++ b/src/junit/com/jogamp/common/util/TestJarUtil.java
@@ -94,10 +94,11 @@ public class TestJarUtil extends JunitTracer {
}
}
- void validateJarFileURL(URI jarFileURI) throws IllegalArgumentException, IOException {
- Assert.assertNotNull(jarFileURI);
- URLConnection aURLc = jarFileURI.toURL().openConnection();
- Assert.assertTrue("jarFileURI/URL has zero content: "+jarFileURI, aURLc.getContentLength()>0);
+ void validateJarFileURL(URI jarFileURI) throws IllegalArgumentException, IOException, URISyntaxException {
+ Assert.assertNotNull(jarFileURI);
+ final URL jarFileURL = IOUtil.toURL(jarFileURI);
+ URLConnection aURLc = jarFileURL.openConnection();
+ Assert.assertTrue("jarFileURI/URL has zero content: "+jarFileURL, aURLc.getContentLength()>0);
System.err.println("URLConnection: "+aURLc);
Assert.assertTrue("Not a JarURLConnection: "+aURLc, (aURLc instanceof JarURLConnection) );
JarURLConnection jURLc = (JarURLConnection) aURLc;
@@ -110,9 +111,10 @@ public class TestJarUtil extends JunitTracer {
Assert.assertNotNull(jarName);
Assert.assertEquals(expJarName, jarName);
- URI jarSubURL = JarUtil.getJarSubURI(clazzBinName, cl);
- Assert.assertNotNull(jarSubURL);
- URLConnection urlConn = jarSubURL.toURL().openConnection();
+ URI jarSubURI = JarUtil.getJarSubURI(clazzBinName, cl);
+ Assert.assertNotNull(jarSubURI);
+ final URL jarSubURL= IOUtil.toURL(jarSubURI);
+ URLConnection urlConn = jarSubURL.openConnection();
Assert.assertTrue("jarSubURL has zero content: "+jarSubURL, urlConn.getContentLength()>0);
System.err.println("URLConnection of jarSubURL: "+urlConn);
diff --git a/src/junit/com/jogamp/common/util/TestTempJarCache.java b/src/junit/com/jogamp/common/util/TestTempJarCache.java
index 7edb286..62a916a 100644
--- a/src/junit/com/jogamp/common/util/TestTempJarCache.java
+++ b/src/junit/com/jogamp/common/util/TestTempJarCache.java
@@ -199,7 +199,7 @@ public class TestTempJarCache extends JunitTracer {
final ClassLoader cl = getClass().getClassLoader();
URI jarUriRoot = JarUtil.getJarSubURI(TempJarCache.class.getName(), cl);
- jarUriRoot = JarUtil.getURIDirname(jarUriRoot);
+ jarUriRoot = IOUtil.getDirname(jarUriRoot);
URI nativeJarURI = JarUtil.getJarFileURI(jarUriRoot, nativeJarName);