RFR: 8353440: Disable FTP fallback for non-local file URLs by default [v10]

Eirik Bjørsnøs eirbjo at openjdk.org
Fri Apr 25 18:41:20 UTC 2025


On Fri, 25 Apr 2025 17:30:41 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:

> Sorry - rewording the release note got me thinking again...

Documentation Driven Development For The Win! 👍

> src/java.base/share/classes/sun/net/www/protocol/file/FileURLConnection.java line 55:
> 
>> 53:             System.getProperty("jdk.net.file.ftpfallback", "false")
>> 54:     );
>> 55: 
> 
> Maybe we should use `Boolean.getBoolean("jdk.net.file.ftpfallback")` here.

I think I did it this way because I wanted the default to be explicit. But, yes Boolean::getBoolean is short and sweet.

> test/jdk/sun/net/www/protocol/file/NonLocalFtpFallbackDisabled.java line 58:
> 
>> 56:         // We can use a fake host name here, no actual FTP request will be made
>> 57:         String hostname = "remotehost";
>> 58:         URL nonLocalURL = new URL("file", hostname, localURL.getFile());
> 
> Should we also check that `new URL("file", hostname, "").openConnection()` will throw MUE?

Not sure why, but can't think of a reason why not. So added that plus avoided the deprectated URL constructor.

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

PR Comment: https://git.openjdk.org/jdk/pull/24657#issuecomment-2831152338
PR Review Comment: https://git.openjdk.org/jdk/pull/24657#discussion_r2060713939
PR Review Comment: https://git.openjdk.org/jdk/pull/24657#discussion_r2060714786


More information about the net-dev mailing list