6933879: URISyntaxException when non-alphanumeric characters are present in scope_id
Reviewed-by: chegar
This commit is contained in:
parent
af3db6d31a
commit
e70362baba
@ -2637,6 +2637,11 @@ public final class URI
|
||||
private static final long H_URIC_NO_SLASH
|
||||
= H_UNRESERVED | H_ESCAPED | highMask(";?:@&=+$,");
|
||||
|
||||
// scope_id = alpha | digit | "_" | "."
|
||||
private static final long L_SCOPE_ID
|
||||
= L_ALPHANUM | lowMask("_.");
|
||||
private static final long H_SCOPE_ID
|
||||
= H_ALPHANUM | highMask("_.");
|
||||
|
||||
// -- Escaping and encoding --
|
||||
|
||||
@ -3226,7 +3231,7 @@ public final class URI
|
||||
if (r+1 == q) {
|
||||
fail ("scope id expected");
|
||||
}
|
||||
checkChars (r+1, q, L_ALPHANUM, H_ALPHANUM,
|
||||
checkChars (r+1, q, L_SCOPE_ID, H_SCOPE_ID,
|
||||
"scope id");
|
||||
} else {
|
||||
parseIPv6Reference(p, q);
|
||||
|
@ -24,7 +24,7 @@
|
||||
/* @test
|
||||
* @summary Unit test for java.net.URI
|
||||
* @bug 4464135 4505046 4503239 4438319 4991359 4866303 7023363 7041800
|
||||
* 7171415
|
||||
* 7171415 6933879
|
||||
* @author Mark Reinhold
|
||||
*/
|
||||
|
||||
@ -1600,6 +1600,7 @@ public class Test {
|
||||
|
||||
static void bugs() {
|
||||
b6339649();
|
||||
b6933879();
|
||||
b8037396();
|
||||
}
|
||||
|
||||
@ -1614,6 +1615,18 @@ public class Test {
|
||||
}
|
||||
}
|
||||
|
||||
// 6933879 - check that "." and "_" characters are allowed in IPv6 scope_id.
|
||||
private static void b6933879() {
|
||||
final String HOST = "fe80::c00:16fe:cebe:3214%eth1.12_55";
|
||||
URI uri;
|
||||
try {
|
||||
uri = new URI("http", null, HOST, 10, "/", null, null);
|
||||
} catch (URISyntaxException ex) {
|
||||
throw new AssertionError("Should not happen", ex);
|
||||
}
|
||||
eq("[" + HOST + "]", uri.getHost());
|
||||
}
|
||||
|
||||
private static void b8037396() {
|
||||
|
||||
// primary checks:
|
||||
|
Loading…
x
Reference in New Issue
Block a user