From 2d615932505d4870f3fd0dd37f21fb3d308ab536 Mon Sep 17 00:00:00 2001
From: Sven Gothel
- * Excluding special native filesystem characters to be encoded. - *
- *- * {@value} + {@code alphanum} - *
- */ - 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 { * */ 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 { * */ 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 { * */ 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); } -- cgit v1.2.3