summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xmake/scripts/runtest.sh4
-rw-r--r--src/java/com/jogamp/common/net/Uri.java51
-rw-r--r--src/junit/com/jogamp/common/net/TestUri03Resolving.java29
3 files changed, 33 insertions, 51 deletions
diff --git a/make/scripts/runtest.sh b/make/scripts/runtest.sh
index c996305..5d1e7d7 100755
--- a/make/scripts/runtest.sh
+++ b/make/scripts/runtest.sh
@@ -112,8 +112,8 @@ function onetest() {
#onetest com.jogamp.common.net.TestURIQueryProps 2>&1 | tee -a $LOG
#onetest com.jogamp.common.net.TestUri01 2>&1 | tee -a $LOG
#onetest com.jogamp.common.net.TestUri02Composing 2>&1 | tee -a $LOG
-onetest com.jogamp.common.net.TestUri03Resolving 2>&1 | tee -a $LOG
-#onetest com.jogamp.common.net.TestUri99LaunchOnReservedCharPathBug908 2>&1 | tee -a $LOG
+#onetest com.jogamp.common.net.TestUri03Resolving 2>&1 | tee -a $LOG
+onetest com.jogamp.common.net.TestUri99LaunchOnReservedCharPathBug908 2>&1 | tee -a $LOG
#onetest com.jogamp.common.net.AssetURLConnectionUnregisteredTest 2>&1 | tee -a $LOG
#onetest com.jogamp.common.net.AssetURLConnectionRegisteredTest 2>&1 | tee -a $LOG
#onetest com.jogamp.junit.sec.TestSecIOUtil01 2>&1 | tee -a $LOG
diff --git a/src/java/com/jogamp/common/net/Uri.java b/src/java/com/jogamp/common/net/Uri.java
index b116cb4..e1363ed 100644
--- a/src/java/com/jogamp/common/net/Uri.java
+++ b/src/java/com/jogamp/common/net/Uri.java
@@ -168,9 +168,11 @@ public class Uri {
* {@value} + {@code alphanum}
* </p>
*/
- public static final String UNRESERVED = "_-.~"; // Harmony: "_-!.~\'()*"
+ public static final String UNRESERVED = "_-.~";
+ // Harmony: _ - ! . ~ ' ( ) *
private static final String punct = ",;:$&+=";
+ // Harmony: , ; : $ & + =
/**
* RFC 3986 section 2.2 Reserved Characters (January 2005)
@@ -178,11 +180,14 @@ public class Uri {
* {@value} + {@code alphanum}
* </p>
*/
- public static final String RESERVED = punct + "!*\'()@/?#[]"; // Harmony: punct + "?/[]@";
+ public static final String RESERVED = punct + "!*\'()@/?#[]";
+ // Harmony: , ; : $ & + = ? / [ ] @
- public static final String RESERVED_2 = punct + "!*\'()@/?[]"; // Harmony: punct + "?/[]@";
+ public static final String RESERVED_2 = punct + "!*\'()@/?[]";
+ // Harmony: , ; : $ & + = ? / [ ] @
// Bug 908, issues w/ windows file path char: $ ^ ~ # [ ]
+ // Windows invalid File characters: * ? " < > |
/**
* Valid charset for RFC 2396 {@code authority}'s {@code user-info},
@@ -192,6 +197,7 @@ public class Uri {
* </p>
*/
public static final String USERINFO_LEGAL = UNRESERVED + punct;
+ // Harmony: someLegal = unreserved + punct -> _ - ! . ~ ' ( ) * , ; : $ & + =
/**
* Valid charset for RFC 2396 {@code authority},
@@ -209,20 +215,8 @@ public class Uri {
* {@value} + {@code alphanum}
* </p>
*/
- public static final String PATH_LEGAL = "/!" + USERINFO_LEGAL;
- // @ is reserved; Harmony: "/@" + SOME_LEGAL, '!' is re-added, Harmony had it in UNRESERVED
-
- /**
- * Reduced valid charset for RFC 2396 {@code path},
- * additional to legal {@code alphanum} characters.
- * <p>
- * Excluding special native filesystem characters to be encoded.
- * </p>
- * <p>
- * {@value} + {@code alphanum}
- * </p>
- */
- public static final String PATH_MIN_LEGAL = "/!_-."; // "/!" + ( unreserved - '~' )
+ public static final String PATH_LEGAL = "/!" + UNRESERVED; // no RESERVED chars but '!', to allow JAR Uris;
+ // Harmony: "/@" + unreserved + punct -> / @ _ - ! . ~ \ ' ( ) * , ; : $ & + =
/**
* Valid charset for RFC 2396 {@code query},
@@ -232,6 +226,7 @@ public class Uri {
* </p>
*/
public static final String QUERY_LEGAL = UNRESERVED + RESERVED_2 + "\\\"";
+ // Harmony: unreserved + reserved + "\\\""
/**
* Valid charset for RFC 2396 {@code scheme-specific-part},
@@ -241,6 +236,7 @@ public class Uri {
* </p>
*/
public static final String SSP_LEGAL = QUERY_LEGAL;
+ // Harmony: unreserved + reserved
/**
* Valid charset for RFC 2396 {@code fragment},
@@ -250,6 +246,7 @@ public class Uri {
* </p>
*/
public static final String FRAG_LEGAL = UNRESERVED + RESERVED;
+ // Harmony: unreserved + reserved
/**
* Immutable RFC3986 encoded string.
@@ -651,13 +648,6 @@ public class Uri {
throw new URISyntaxException(path, "path doesn't start with '/'");
}
- final boolean extendedPath;
- if( emptyString(query) || emptyString(fragment) ) {
- extendedPath = true;
- } else {
- extendedPath = false;
- }
-
final StringBuilder uri = new StringBuilder();
if ( !emptyString(scheme) ) {
uri.append(scheme);
@@ -691,7 +681,7 @@ public class Uri {
if ( !emptyString(path) ) {
// QUOTE ILLEGAL CHARS
- uri.append(encode(path, extendedPath ? PATH_MIN_LEGAL : PATH_LEGAL));
+ uri.append(encode(path, PATH_LEGAL));
}
if ( !emptyString(query) ) {
@@ -759,13 +749,6 @@ public class Uri {
throw new URISyntaxException(path, "path doesn't start with '/'");
}
- final boolean extendedPath;
- if( emptyString(query) || emptyString(fragment) ) {
- extendedPath = true;
- } else {
- extendedPath = false;
- }
-
final StringBuilder uri = new StringBuilder();
if ( !emptyString(scheme) ) {
uri.append(scheme);
@@ -779,7 +762,7 @@ public class Uri {
if ( !emptyString(path) ) {
// QUOTE ILLEGAL CHARS
- uri.append(encode(path, extendedPath ? PATH_MIN_LEGAL : PATH_LEGAL));
+ uri.append(encode(path, PATH_LEGAL));
}
if ( !emptyString(query) ) {
// QUOTE ILLEGAL CHARS
@@ -834,7 +817,7 @@ public class Uri {
uri.append(IOUtil.SCHEME_SEPARATOR);
// QUOTE ILLEGAL CHARS
- uri.append(encode(path, PATH_MIN_LEGAL));
+ uri.append(encode(path, PATH_LEGAL));
return new Uri(new Encoded(uri.toString()), false);
}
diff --git a/src/junit/com/jogamp/common/net/TestUri03Resolving.java b/src/junit/com/jogamp/common/net/TestUri03Resolving.java
index 0d65363..7c1dadf 100644
--- a/src/junit/com/jogamp/common/net/TestUri03Resolving.java
+++ b/src/junit/com/jogamp/common/net/TestUri03Resolving.java
@@ -72,31 +72,30 @@ public class TestUri03Resolving extends JunitTracer {
};
public static final String[][] uriFileSArrayWindows = new String[][] {
- new String[] {"file:/C:/gluegen/build-x86_64/gluegen-rt.jar"},
new String[] {"file:/C%3A/gluegen/build-x86_64/gluegen-rt.jar"},
- new String[] {"file:/C:/gluegen/"+'\u0394'+"/gluegen-rt.jar"},
+ new String[] {"file:/C%3A/gluegen/"+'\u0394'+"/gluegen-rt.jar"},
- new String[] {"file:/C:/gluegen/build-x86_64%20lala/gluegen-rt.jar"},
+ new String[] {"file:/C%3A/gluegen/build-x86_64%20lala/gluegen-rt.jar"},
- new String[] {"file:/C:/gluegen/build-x86_64%20öä%20lala/gluegen-rt.jar"},
+ new String[] {"file:/C%3A/gluegen/build-x86_64%20öä%20lala/gluegen-rt.jar"},
- new String[] {"jar:file:/C:/gluegen/build-x86_64/gluegen-rt.jar!/"},
+ new String[] {"jar:file:/C%3A/gluegen/build-x86_64/gluegen-rt.jar!/"},
- new String[] {"jar:file:/C:/gluegen/build-x86_64%20öä%20lala/gluegen-rt.jar!/"},
+ new String[] {"jar:file:/C%3A/gluegen/build-x86_64%20öä%20lala/gluegen-rt.jar!/"},
- new String[] {"jar:file:/C:/gluegen/build-x86_64/gluegen-rt.jar!/com/jogamp/common/os/Platform.class"},
+ new String[] {"jar:file:/C%3A/gluegen/build-x86_64/gluegen-rt.jar!/com/jogamp/common/os/Platform.class"},
- new String[] {"jar:file:/C:/gluegen/build-x86_64%20öä%20lala/gluegen-rt.jar!/com/jogamp/common/os/Platform.class"},
+ new String[] {"jar:file:/C%3A/gluegen/build-x86_64%20öä%20lala/gluegen-rt.jar!/com/jogamp/common/os/Platform.class"},
new String[] {"jar:file:/C%3A/gluegen/build-x86_64%20öä%20lala/gluegen-rt.jar!/com/jogamp/common/os/Platform.class"},
- new String[] {"jar:file:///C:/gluegen/build-x86_64%20öä%20lala/gluegen-rt.jar!/com/jogamp/common/os/Platform.class"},
+ new String[] {"jar:file:///C%3A/gluegen/build-x86_64%20öä%20lala/gluegen-rt.jar!/com/jogamp/common/os/Platform.class"},
new String[] {"jar:file://filehost/gluegen/build-x86_64%20öä%20lala/gluegen-rt.jar!/com/jogamp/common/os/Platform.class"},
- new String[] {"jar:file:/C:/gluegen/R%23/gluegen-rt.jar!/"},
+ new String[] {"jar:file:/C%3A/gluegen/R%23/gluegen-rt.jar!/"},
- new String[] {"jar:file:/C:/gluegen/"+'\u0394'+"/gluegen-rt.jar!/"},
+ new String[] {"jar:file:/C%3A/gluegen/"+'\u0394'+"/gluegen-rt.jar!/"},
};
public static final String[][] fileSArrayUnix = new String[][] {
@@ -117,11 +116,11 @@ public class TestUri03Resolving extends JunitTracer {
"/gluegen/build-x86_64 öä lala/gluegen-rt.jar"},
new String[] {"/gluegen/A$/B^/C~/D#/E[/F]/gluegen-rt.jar",
- "file:/gluegen/A%24/B%5E/C%7E/D%23/E%5B/F%5D/gluegen-rt.jar",
+ "file:/gluegen/A%24/B%5E/C~/D%23/E%5B/F%5D/gluegen-rt.jar",
"/gluegen/A$/B^/C~/D#/E[/F]/gluegen-rt.jar" },
new String[] {"/gluegen/$/^/~/#/[/]/gluegen-rt.jar",
- "file:/gluegen/%24/%5E/%7E/%23/%5B/%5D/gluegen-rt.jar",
+ "file:/gluegen/%24/%5E/~/%23/%5B/%5D/gluegen-rt.jar",
"/gluegen/$/^/~/#/[/]/gluegen-rt.jar" },
};
@@ -151,11 +150,11 @@ public class TestUri03Resolving extends JunitTracer {
"\\\\filehost\\gluegen\\build-x86_64 öä lala\\gluegen-rt.jar"},
new String[] {"C:/gluegen/A$/B^/C~/D#/E[/F]/gluegen-rt.jar",
- "file:/C%3A/gluegen/A%24/B%5E/C%7E/D%23/E%5B/F%5D/gluegen-rt.jar",
+ "file:/C%3A/gluegen/A%24/B%5E/C~/D%23/E%5B/F%5D/gluegen-rt.jar",
"C:\\gluegen\\A$\\B^\\C~\\D#\\E[\\F]\\gluegen-rt.jar" },
new String[] {"C:/gluegen/$/^/~/#/[/]/gluegen-rt.jar",
- "file:/C%3A/gluegen/%24/%5E/%7E/%23/%5B/%5D/gluegen-rt.jar",
+ "file:/C%3A/gluegen/%24/%5E/~/%23/%5B/%5D/gluegen-rt.jar",
"C:\\gluegen\\$\\^\\~\\#\\[\\]\\gluegen-rt.jar" },
};