RFR: 8282395: URL.openConnection can throw IOOBE
KIRIYAMA Takuya
duke at openjdk.java.net
Wed Jun 15 01:07:39 UTC 2022
On Thu, 14 Apr 2022 08:47:12 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:
>>> MalformedURLException should probably be thrown instead of simply accepting a malformed % encoded pair.
>>
>> Thank you very much for your comment.
>> 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?
>
>> 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)
> | ...
@dfuch
Sorry to bother you, but I want you to review this fix again.
-------------
PR: https://git.openjdk.org/jdk/pull/8155
More information about the net-dev
mailing list