RFR: 8282395: URL.openConnection can throw IOOBE [v2]

KIRIYAMA Takuya duke at openjdk.org
Fri Jun 17 06:36:54 UTC 2022


On Wed, 15 Jun 2022 10:23:40 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:

>> KIRIYAMA Takuya has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains three additional commits since the last revision:
>> 
>>  - #8282395 URL.openConnection can throw IOOBE
>>  - Merge branch 'master' into 8282395
>>  - 8282395: URL.openConnection can throw IOOBE
>
> src/java.base/share/classes/java/net/URL.java line 1101:
> 
>> 1099:             throw new MalformedURLException(e.getMessage());
>> 1100:         }
>> 1101:         return url;
> 
> Please revert the changes in java.net.URL. It's not the proper place to do the conversion. If a conversion is needed, it should take place in the handler.
> One possible experiment could be to  change `ParseUtil::decode` to declare `throws MalformedURLException` and see what no longer compiles. If compilation passes - then maybe that's the way to go. If it doesn't - then we could analyze what to do on a case-by-case basis.

There are some methods call ParseUtil::decode and of these 10 are not declared to be thrown MalformedURLException.
Modifying ParseUtil :: decode has not a little impact. Is modifying java.net.URL not proper?

The following classes have the methods which are not declared to be thrown MalformedURLException.


java.net.URLClassLoader
sun.net.www.protocol.ftp.FtpURLConnection
sun.security.provider.PolicyFile
jdk.internal.loader.FileURLMapper

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

PR: https://git.openjdk.org/jdk/pull/8155


More information about the net-dev mailing list