RFR: 8350880: (zipfs) Add support for read-only zip file systems [v4]
David Beaumont
duke at openjdk.org
Mon May 19 11:52:56 UTC 2025
On Fri, 16 May 2025 14:37:28 GMT, Jaikiran Pai <jpai at openjdk.org> wrote:
>> David Beaumont has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Changes based on review feedback.
>
> src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipFileSystem.java line 241:
>
>> 239: this.readOnly = forceReadOnly || multiReleaseVersion.isPresent() || !Files.isWritable(zfpath);
>> 240: if (readOnly && accessMode == AccessMode.READ_WRITE) {
>> 241: String reason = Files.isWritable(zfpath)
>
> Nit - this additional call to Files.isWritable(...) can be avoided if we store the value of the previous call (a couple of lines above). I realize that the previous `Files.isWritable` is stashed at the end of the `||` conditionals to prevent it from being invoked in certain situations.
>
> So maybe a better change would be something like:
>
>
> String reason = multiReleaseVersion.isPresent()
> ? "A multi-release JAR file opened with a specified version is not writable"
> : "The underlying ZIP file is not writable";
>
>
> which would then avoid any additional calls to `Files.isWritable`.
Done.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25178#discussion_r2095532769
More information about the core-libs-dev
mailing list