RFR: 8282395: URL.openConnection can throw IOOBE

Daniel Fuchs dfuchs at openjdk.java.net
Thu Apr 14 08:51:15 UTC 2022


On Thu, 14 Apr 2022 06:56:24 GMT, KIRIYAMA Takuya <duke at openjdk.java.net> wrote:

> I think we should accept any codes like "%25%s%G1" according to URL standard.
> 
> Is there a reason why an exception should be thrown?

Yes. It is not a valid escape sequence according to the spec.


jshell> URI.create("ftp://host:5678/%25%s%G1");
|  Exception java.lang.IllegalArgumentException: Malformed escape pair at index 19: ftp://host:5678/%25%s%G1
|        at URI.create (URI.java:906)
|        at (#1:1)
|  Caused by: java.net.URISyntaxException: Malformed escape pair at index 19: ftp://host:5678/%25%s%G1
|        at URI$Parser.fail (URI.java:2973)
|        at URI$Parser.scanEscape (URI.java:3101)
|        at URI$Parser.scan (URI.java:3124)
|        at URI$Parser.checkChars (URI.java:3142)
|        at URI$Parser.parseHierarchical (URI.java:3226)
|        at URI$Parser.parse (URI.java:3174)
|        at URI.<init> (URI.java:623)
|        at URI.create (URI.java:904)
|        ...

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

PR: https://git.openjdk.java.net/jdk/pull/8155


More information about the net-dev mailing list