On Thu, 24 Nov 2022 12:19:13 GMT, Jaikiran Pai <[email protected]> wrote:

> Can I please get a review of this change which proposes to fix 
> https://bugs.openjdk.org/browse/JDK-8297569?
> 
> Recently we fixed a bug in `java.net.URLPermission` where that class used to 
> run into an exception while trying to convert a hostname into lowercase, when 
> run in Turkish locale https://bugs.openjdk.org/browse/JDK-8294378. The 
> approach we decided to take in that fix  was to use an internal 
> `HostPortRange.toLowerCase` method which was unaffected by `Locale`s. The 
> other alternative was to use `String.toLowerCase(Locale.ROOT)`, but we 
> decided to use the former since it was already being used in other parts of 
> the code in that area.
> 
> The implementation of `HostPortRange.toLowerCase` is very strict and it 
> allows only a specific set of characters. The `_` (underscore character) 
> isn't one of them. Before the change we did there, a `URLPermission` 
> constructor could be passed a string `http://foo_bar` and it used to 
> construct the instance successfully. However, after that change, it now fails 
> with the exception noted in the issue.
> 
> The commit here reverts the previous fix and instead now uses 
> `String.toLowerCase(Locale.ROOT)` to lowercase the authority. Additionally, 
> an `else` block that we had introduced in the previous fix has been removed 
> to bring us back to the old behaviour.
> 
> The test has been updated to include `http://foo_bar` (and its one more 
> variant) string to construct the `URLPermission` instance.
> 
> JCK testing with the changes in this PR passed and other `tier` testing is 
> currently in progress.

Thank you Daniel for the review.

-------------

PR: https://git.openjdk.org/jdk/pull/11353

Reply via email to