RFR: 8353278: Consolidate local file URL checks in jar: and file: URL schemes [v2]
Eirik Bjørsnøs
eirbjo at openjdk.org
Mon Apr 7 13:26:45 UTC 2025
> Please help review this cleanup PR which consolidates 'local file' URL checks across the 'file:' and 'jar:' URL scheme implementations and defines this check in terms of RFC 8089, Section 2.
>
> This PR:
>
> * Moves `URLJarFile.isFileURL` to `sun.net.www.ParseUtil` where it is documented according to RFC 8089 and given the more suitable name `isLocalFileURL`
> * Updates `isLocalFileURL` to simplify an `if (x) return true;` statement to `return x;`
> * Updates `URLJarFile.getJarFile` and `JarFileFactory.getOrCreate` to use `isLocalFileURL`
> * Updates `JarFileFactory.urlFor` to use `isLocalFileURL` (while maintaining and documenting the historical and subtly different non-treatment of '~' as an alias for 'localhost')
> * Updates `sun.net.www.protocol.file.Handler.openConnection` to use `isLocalFileURL` in windows/unix implementations
>
> This is a pure cleanup / refactoring PR, no tests are updated here. Existing testing in this area seems sparse, so I have tried to limit the number of code tweaks to a minimium to make reviews easier.
>
> Testing: GHA runs green, as well as tier2 on MacOS.
Eirik Bjørsnøs has updated the pull request incrementally with one additional commit since the last revision:
Update copyright year
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/24332/files
- new: https://git.openjdk.org/jdk/pull/24332/files/68fe3458..752a2132
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=24332&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=24332&range=00-01
Stats: 1 line in 1 file changed: 0 ins; 0 del; 1 mod
Patch: https://git.openjdk.org/jdk/pull/24332.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/24332/head:pull/24332
PR: https://git.openjdk.org/jdk/pull/24332
More information about the net-dev
mailing list