Details
-
Bug
-
Resolution: Fixed
-
P4
-
None
-
b26
-
Verified
Backports
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8311994 | 17.0.9 | Dhamoder Nalla | P4 | Resolved | Fixed | b01 |
JDK-8313549 | 11.0.21 | Dhamoder Nalla | P4 | Resolved | Fixed | b01 |
Description
Exception:
java.net.URISyntaxException: Illegal character in hostname at index N: xyz1_abcd.com
at java.base/java.net.URI$Parser.fail(URI.java:2943)
at java.base/java.net.URI$Parser.parseHostname(URI.java:3487)
at java.base/java.net.URI$Parser.parseServer(URI.java:3329)
This exception is silent and does not produce any messages, except for ODP profiler, there is no other evidence that it’s happening (the stack trace above was printed after changes to Java library). The reason for this is because of how the URI creation is implemented in the java.net.URI class (link here: https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/java/net/URI.java#L3527). There are two paths for creating a valid URI, and one of them goes through an exception.
We can see that if parseServer fails, there is still a way the authority gets assigned and we don’t throw an exception from the method. This means, not being able to parse the server is ok and the exception is silenced. In our case, the server parsing fails because we find an illegal character, as only alphanumeric and dash characters are allowed.
Created on behalf of Dhamoder Nalla @ Microsoft.
Attachments
Issue Links
- backported by
-
JDK-8311994 Parsing a URI with an underscore goes through a silent exception, negatively impacting performance
- Resolved
-
JDK-8313549 Parsing a URI with an underscore goes through a silent exception, negatively impacting performance
- Resolved
- links to
-
Commit openjdk/jdk11u-dev/adc74777
-
Commit openjdk/jdk17u-dev/310115aa
-
Commit openjdk/jdk/749d4801
-
Review openjdk/jdk11u-dev/2041
-
Review openjdk/jdk/13430
-
Review(master) openjdk/jdk17u-dev/1428