8294378: URLPermission constructor exception when using tr locale

Reviewed-by: dfuchs, jpai, aefimov
This commit is contained in:
Ryan Wallace 2022-11-12 01:37:46 +00:00 committed by Jaikiran Pai
parent 34a499de8e
commit ff2c987669
3 changed files with 13 additions and 5 deletions

View File

@ -149,6 +149,9 @@ class HostPortrange {
// regular domain name
hoststr = toLowerCase(hoststr);
}
} else {
// regular domain name
hoststr = toLowerCase(hoststr);
}
}
hostname = hoststr;

View File

@ -31,6 +31,7 @@ import java.util.List;
import java.util.ArrayList;
import java.util.Collections;
import java.security.Permission;
import java.util.Locale;
/**
* Represents permission to access a resource or set of resources defined by a
@ -471,7 +472,7 @@ public final class URLPermission extends Permission {
throw new IllegalArgumentException(
"Invalid URL string: \"" + url + "\"");
}
scheme = url.substring(0, delim).toLowerCase();
scheme = url.substring(0, delim).toLowerCase(Locale.ROOT);
this.ssp = url.substring(delim + 1);
if (!ssp.startsWith("//")) {
@ -493,7 +494,7 @@ public final class URLPermission extends Permission {
auth = authpath.substring(0, delim);
this.path = authpath.substring(delim);
}
this.authority = new Authority(scheme, auth.toLowerCase());
this.authority = new Authority(scheme, auth);
}
private String actions() {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -26,7 +26,9 @@ import java.io.*;
/**
* @test
* @bug 8010464 8027570 8027687 8029354 8114860 8071660 8161291
* @bug 8010464 8027570 8027687 8029354 8114860 8071660 8161291 8294378
* @run main URLPermissionTest
* @run main/othervm -Duser.language=tr URLPermissionTest
*/
public class URLPermissionTest {
@ -392,7 +394,9 @@ public class URLPermissionTest {
eqtest("http://michael@foo.com/bar","http://michael@foo.com/bar", true),
eqtest("http://Michael@foo.com/bar","http://michael@goo.com/bar",false),
eqtest("http://michael@foo.com/bar","http://george@foo.com/bar", true),
eqtest("http://@foo.com/bar","http://foo.com/bar", true)
eqtest("http://@foo.com/bar","http://foo.com/bar", true),
eqtest("http://www.IOU.com", "http://www.iou.com", true),
eqtest("HTTPI://www.IOU.com", "httpi://www.iou.com", true)
};
static Test[] createTests = {