summaryrefslogtreecommitdiffstats
path: root/src/junit/com/jogamp/common/net/TestUri99LaunchOnReservedCharPathBug908.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-09-08 05:09:02 +0200
committerSven Gothel <[email protected]>2014-09-08 05:09:02 +0200
commitdde91a061cb0bc209442fe0e74a532b91d1bb4b8 (patch)
tree9c046c2d5deb74cb45296cbd400c56cf0a2c60fd /src/junit/com/jogamp/common/net/TestUri99LaunchOnReservedCharPathBug908.java
parent6322991799268166e46aeeacb142c11d45950f48 (diff)
Bug 1063: Complete Uri impl. and adoption throughout GlueGen
- Uri: - Add error correction (fix) of path at ctor in case a a contained Uri is requested from an opaque one. The latter might come from URI/URL and is not properly encoded! See Uri.PARSE_HINT_FIX_PATH - Simplify conversion methods: - valueOf(URI/URL): Re-encode only if not opaque - getNativeFilePath() -> toFile() - Move IOUtil Uri related constants to class Uri - Add DEBUG and DEBUG_SHOWFIX - Complete adoption of URI -> Uri changes - IOUtil, JarUtil and TempJarCache still holds some left over deprecated methods, which will be removed after officially starting 2.3.0 (JOGL dependencies) - Otherwise not URI utilization left - Tests - Cleaned ip TestUri01 and TestUri03Resolving - TestUri03Resolving also tests URL -> Uri, and hence mentioned Uri.PARSE_HINT_FIX_PATH
Diffstat (limited to 'src/junit/com/jogamp/common/net/TestUri99LaunchOnReservedCharPathBug908.java')
-rw-r--r--src/junit/com/jogamp/common/net/TestUri99LaunchOnReservedCharPathBug908.java26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/junit/com/jogamp/common/net/TestUri99LaunchOnReservedCharPathBug908.java b/src/junit/com/jogamp/common/net/TestUri99LaunchOnReservedCharPathBug908.java
index 011b18c..09748a1 100644
--- a/src/junit/com/jogamp/common/net/TestUri99LaunchOnReservedCharPathBug908.java
+++ b/src/junit/com/jogamp/common/net/TestUri99LaunchOnReservedCharPathBug908.java
@@ -42,7 +42,6 @@ import org.junit.runners.MethodSorters;
import com.jogamp.common.os.AndroidVersion;
import com.jogamp.common.os.Platform;
-import com.jogamp.common.util.IOUtil;
import com.jogamp.common.util.JarUtil;
import com.jogamp.common.util.ReflectionUtil;
import com.jogamp.junit.util.JunitTracer;
@@ -84,16 +83,16 @@ public class TestUri99LaunchOnReservedCharPathBug908 extends JunitTracer {
@Test
public void test00TempJarCacheSimplePath() throws IOException, IllegalArgumentException, URISyntaxException {
- testTempJarCacheOddJarPathImpl("simpletons/", "simpletons/");
+ testTempJarCacheOddJarPathImpl("simpletons/");
}
@Test
public void test01TempJarCacheOddPath() throws IOException, IllegalArgumentException, URISyntaxException {
// Bug 908, issues w/ windows file path char: $ ^ ~ # [ ]
- testTempJarCacheOddJarPathImpl("A$-B^-C~-D#-E]-F[-öä/",
+ testTempJarCacheOddJarPathImpl("A$-B^-C~-D#-E]-F[-öä/");
// "A$-B%5E-C~-D#-E]-F[-%C3%B6%C3%A4/"); <- Firefox URI encoding! '#' -> [1]
// "A$-B%5E-C~-D%23-E]-F[-%C3%B6%C3%A4/"); <- '[' ']' -> [2]
- "A$-B%5E-C~-D%23-E%5D-F%5B-%C3%B6%C3%A4/");
+ // "A$-B%5E-C~-D%23-E%5D-F%5B-%C3%B6%C3%A4/");
/**
* [1] '#'
java.lang.IllegalArgumentException: URI has a fragment component
@@ -111,34 +110,35 @@ public class TestUri99LaunchOnReservedCharPathBug908 extends JunitTracer {
*/
}
- private void testTempJarCacheOddJarPathImpl(final String subPathUTF, final String subPathEncoded) throws IOException, IllegalArgumentException, URISyntaxException {
+ private void testTempJarCacheOddJarPathImpl(final String subPathUTF) throws IOException, IllegalArgumentException, URISyntaxException {
if(AndroidVersion.isAvailable) { System.err.println("n/a on Android"); return; }
+ final Uri.Encoded subPathEncoded = new Uri.Encoded(subPathUTF, Uri.PATH_LEGAL);
final String reservedCharPathUnencoded = "test/build/"+getClass().getSimpleName()+"/"+getTestMethodName()+"/"+subPathUTF;
- final String reservedCharPathEncoded = "test/build/"+getClass().getSimpleName()+"/"+getTestMethodName()+"/"+subPathEncoded;
+ final Uri.Encoded reservedCharPathEncoded = Uri.Encoded.cast("test/build/"+getClass().getSimpleName()+"/"+getTestMethodName()+"/").concat(subPathEncoded);
System.err.println("0 Unencoded: "+reservedCharPathUnencoded);
System.err.println("0 Encoded: "+reservedCharPathEncoded);
// jar:file:/dir1/dir2/gluegen-rt.jar!/
- final URI jarFileURI = JarUtil.getJarFileURI(Platform.class.getName(), getClass().getClassLoader());
+ final Uri jarFileURI = JarUtil.getJarFileUri(Platform.class.getName(), getClass().getClassLoader());
System.err.println("1 jarFileURI: "+jarFileURI.toString());
// gluegen-rt.jar
- final String jarBasename = JarUtil.getJarBasename(jarFileURI);
+ final Uri.Encoded jarBasename = JarUtil.getJarBasename(jarFileURI);
System.err.println("2 jarBasename: "+jarBasename);
// file:/dir1/build/gluegen-rt.jar
- final URI fileURI = JarUtil.getJarSubURI(jarFileURI);
+ final Uri fileURI = jarFileURI.getContainedUri();
System.err.println("3 fileURI: "+fileURI.toString());
// file:/dir1/build/
- final URI fileFolderURI = new URI(IOUtil.getParentOf(fileURI.toString()));
+ final Uri fileFolderURI = fileURI.getParent();
System.err.println("4 fileFolderURI: "+fileFolderURI.toString());
// file:/dir1/build/test/build/A$-B^-C~-D#-E]-F[/
- final URI fileNewFolderURI = new URI(fileFolderURI.toString()+reservedCharPathEncoded);
+ final Uri fileNewFolderURI = fileFolderURI.concat(reservedCharPathEncoded);
System.err.println("5 fileNewFolderURI: "+fileNewFolderURI.toString());
- final File srcFolder = new File(fileFolderURI);
- final File dstFolder = new File(fileNewFolderURI);
+ final File srcFolder = fileFolderURI.toFile();
+ final File dstFolder = fileNewFolderURI.toFile();
System.err.println("6 srcFolder: "+srcFolder.toString());
System.err.println("7 dstFolder: "+dstFolder.toString());
try {