Integrated: 8353013: java.net.URI.create(String) may have low performance to scan the host/domain name from URI string when the hostname starts with number
Rohitash Kumar
duke at openjdk.org
Wed Apr 16 16:11:51 UTC 2025
On Fri, 28 Mar 2025 15:19:46 GMT, Rohitash Kumar <duke at openjdk.org> wrote:
> `scanByte` throws `NumberFormatException` for URIs that start with numbers, e.g., https://11111111.x.y/
> The current flow is `parseIPv4Address` → `scanIPv4Address` → `scanByte`. `parseIPv4Address` uses `NumberFormatException` for control flow, so it captures the exception, ignores it, and returns -1. This has been reported by AWS customer to cause low performance. Details: [JDK-8353013](https://bugs.openjdk.org/browse/JDK-8353013) & https://github.com/aws/aws-sdk-java-v2/issues/5933
>
> This PR avoids NumberFormatException by skipping calls to `Integer.parseInt` if the number of digits in the octet is > 3.
>
>
> I ran following tests.
>
> make test-tier1
> make test-tier2
> make test TEST=jdk/java/net
This pull request has now been integrated.
Changeset: 84458ec1
Author: Rohitash Kumar <kurohita at amazon.com>
Committer: Michael McMahon <michaelm at openjdk.org>
URL: https://git.openjdk.org/jdk/commit/84458ec18ce33295636f7b26b8e3ff25ecb349f2
Stats: 112 lines in 3 files changed: 109 ins; 0 del; 3 mod
8353013: java.net.URI.create(String) may have low performance to scan the host/domain name from URI string when the hostname starts with number
Reviewed-by: michaelm, xpeng
-------------
PR: https://git.openjdk.org/jdk/pull/24295
More information about the net-dev
mailing list