Originally reported: https://github.com/adoptium/adoptium-support/issues/611
### Please provide a brief summary of the bug
We rely on URI class implements reasonably well RFC-2396. Recently faced a confusing case.
### Please provide steps to reproduce where possible
```
PS C:\app\jdk-17.0.5+8> bin/jshell
| Welcome to JShell -- Version 17.0.5
| For an introduction type: /help intro
jshell> new URI("ftps", "p.e.local|SIT@p.e.local", "/path", null)
| Exception java.net.URISyntaxException: Illegal character in authority at index 7: ftps://p.e.local|SIT@p.e.local/path
| at URI$Parser.fail (URI.java:2974)
| at URI$Parser.parseAuthority (URI.java:3308)
| at URI$Parser.parseHierarchical (URI.java:3219)
| at URI$Parser.parse (URI.java:3175)
| at URI.<init> (URI.java:708)
| at URI.<init> (URI.java:809)
| at (#1:1)
```
### Expected Results
The message should make sense, the index of the invalid character should be relative to the presented URI string.
```
jshell> "ftps://p.e.local|SIT@p.e.local/path".indexOf("|")
$4 ==> 16
```
### Actual Results
Above index ``7`` in ``ftps://p.e.local|SIT@p.e.local/path`` results in ``p``.
```
jshell> "ftps://p.e.local|SIT@p.e.local/path".charAt(7)
$3 ==> 'p'
```
### What Java Version are you using?
openjdk version "17.0.5"
### What is your operating system and platform?
Win 10 on AMD x64
### How did you install Java?
_No response_
### Did it work before?
_No response_
### Did you test with other Java versions?
```shell
Java 11.0.16.1
```
### Relevant log output
_No response_
### Extra info
I'm sure about the incorrect index because ``p`` is a valid char.
Indeed this evident smell raises subsequent questions.
For ``|``, it comes from observations that it is the pipe disrupting the URI.
I'm not sure if ``|`` should or should not be rejected, spec-wise:
java.net.URI JavaDoc is silent on ``|``, the other category there matches non-US-ASCII chars, but ``|`` is US-ASCII char.
RFC https://www.ietf.org/rfc/rfc2396.txt mentions ``|`` in the unwise category.
### Please provide a brief summary of the bug
We rely on URI class implements reasonably well RFC-2396. Recently faced a confusing case.
### Please provide steps to reproduce where possible
```
PS C:\app\jdk-17.0.5+8> bin/jshell
| Welcome to JShell -- Version 17.0.5
| For an introduction type: /help intro
jshell> new URI("ftps", "p.e.local|SIT@p.e.local", "/path", null)
| Exception java.net.URISyntaxException: Illegal character in authority at index 7: ftps://p.e.local|SIT@p.e.local/path
| at URI$Parser.fail (URI.java:2974)
| at URI$Parser.parseAuthority (URI.java:3308)
| at URI$Parser.parseHierarchical (URI.java:3219)
| at URI$Parser.parse (URI.java:3175)
| at URI.<init> (URI.java:708)
| at URI.<init> (URI.java:809)
| at (#1:1)
```
### Expected Results
The message should make sense, the index of the invalid character should be relative to the presented URI string.
```
jshell> "ftps://p.e.local|SIT@p.e.local/path".indexOf("|")
$4 ==> 16
```
### Actual Results
Above index ``7`` in ``ftps://p.e.local|SIT@p.e.local/path`` results in ``p``.
```
jshell> "ftps://p.e.local|SIT@p.e.local/path".charAt(7)
$3 ==> 'p'
```
### What Java Version are you using?
openjdk version "17.0.5"
### What is your operating system and platform?
Win 10 on AMD x64
### How did you install Java?
_No response_
### Did it work before?
_No response_
### Did you test with other Java versions?
```shell
Java 11.0.16.1
```
### Relevant log output
_No response_
### Extra info
I'm sure about the incorrect index because ``p`` is a valid char.
Indeed this evident smell raises subsequent questions.
For ``|``, it comes from observations that it is the pipe disrupting the URI.
I'm not sure if ``|`` should or should not be rejected, spec-wise:
java.net.URI JavaDoc is silent on ``|``, the other category there matches non-US-ASCII chars, but ``|`` is US-ASCII char.
RFC https://www.ietf.org/rfc/rfc2396.txt mentions ``|`` in the unwise category.
- relates to
-
JDK-8214219 URISyntaxException: Illegal character in query at index <index_no> is thrown for the specified URL address
-
- Open
-