diff options
author | Sven Gothel <[email protected]> | 2015-10-03 11:44:02 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2015-10-03 11:44:02 +0200 |
commit | 026875dd5256051d4e3504f1d9b01f7ce2bb70ff (patch) | |
tree | d7d1bd386c870787ffcf737ca6baaeaa6f73ef11 /src/junit/com/jogamp/common/net | |
parent | 48cef027ec727d3e03b78f577208d1ce10b705d1 (diff) |
Bug 1243 - Fix IOUtil.cleanPathString(..) special case ; Allow IOUtil and Uri to handle relative path
Fix IOUtil.cleanPathString(..) special case:
Special case '/a/./../b' -> '/b'
requires to resolve './' before '../'.
Allow IOUtil and Uri to handle relative path:
- IOUtil.getParentOf(..)
- IOUtil.cleanPathString(..)
Handle cases:
'a/./../b' -> 'b'
'.././b' -> '../b'
- Uri: Handle null scheme
Diffstat (limited to 'src/junit/com/jogamp/common/net')
-rw-r--r-- | src/junit/com/jogamp/common/net/TestUri01.java | 32 |
1 files changed, 30 insertions, 2 deletions
diff --git a/src/junit/com/jogamp/common/net/TestUri01.java b/src/junit/com/jogamp/common/net/TestUri01.java index 1173610..4205de1 100644 --- a/src/junit/com/jogamp/common/net/TestUri01.java +++ b/src/junit/com/jogamp/common/net/TestUri01.java @@ -248,6 +248,20 @@ public class TestUri01 extends SingletonJunitCase { @Test public void test08NormalizedHierarchy() throws IOException, URISyntaxException { { + final Uri input = Uri.cast("./dummy/nop/../a.txt"); + final Uri expected = Uri.cast("dummy/a.txt"); + URIDumpUtil.showUri(input); + final Uri normal = input.getNormalized(); + Assert.assertEquals(expected, normal); + } + { + final Uri input = Uri.cast("../dummy/nop/../a.txt"); + final Uri expected = Uri.cast("../dummy/a.txt"); + URIDumpUtil.showUri(input); + final Uri normal = input.getNormalized(); + Assert.assertEquals(expected, normal); + } + { final Uri input = Uri.cast("http://localhost/dummy/../"); final Uri expected = Uri.cast("http://localhost/"); URIDumpUtil.showUri(input); @@ -255,7 +269,21 @@ public class TestUri01 extends SingletonJunitCase { Assert.assertEquals(expected, normal); } { - final Uri input = Uri.cast("http://localhost/test/dummy/../text.txt"); + final Uri input = Uri.cast("http://localhost/dummy/./../"); + final Uri expected = Uri.cast("http://localhost/"); + URIDumpUtil.showUri(input); + final Uri normal = input.getNormalized(); + Assert.assertEquals(expected, normal); + } + { + final Uri input = Uri.cast("http://localhost/dummy/../aa/././../"); + final Uri expected = Uri.cast("http://localhost/"); + URIDumpUtil.showUri(input); + final Uri normal = input.getNormalized(); + Assert.assertEquals(expected, normal); + } + { + final Uri input = Uri.cast("http://localhost/test/dummy/./../text.txt"); final Uri expected = Uri.cast("http://localhost/test/text.txt"); URIDumpUtil.showUri(input); final Uri normal = input.getNormalized(); @@ -280,7 +308,7 @@ public class TestUri01 extends SingletonJunitCase { Assert.assertEquals(expected, normal); } { - final Uri input = Uri.cast("jar:http://localhost/test/dummy/../abc.jar!/"); + final Uri input = Uri.cast("jar:http://localhost/test/./dummy/../abc.jar!/"); final Uri expected = Uri.cast("jar:http://localhost/test/abc.jar!/"); URIDumpUtil.showUri(input); final Uri normal = input.getNormalized(); |