RFR: 8214248: (fs) Files:mismatch spec clarifications [v2]

Brian Burkhalter bpb at openjdk.org
Mon Aug 21 15:35:48 UTC 2023


On Sat, 19 Aug 2023 19:03:33 GMT, Alan Bateman <alanb at openjdk.org> wrote:

>> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   8214248: Revise verbiage; revert package file
>
> src/java.base/share/classes/java/nio/file/Files.java line 1573:
> 
>> 1571:      * and {@code g}, {@code mismatch(f,g)} will return the same value as
>> 1572:      * {@code mismatch(g,f)}). If both paths locate the same file, the file
>> 1573:      * system is not accessed.
> 
> The only case where there is no file system access is when the paths are equal.

Changed in 1bd9436ad7567b96c1baa14489721d93d7e7a436.

> src/java.base/share/classes/java/nio/file/Files.java line 1588:
> 
>> 1586:      *          installed, the {@link SecurityManager#checkRead(String) checkRead}
>> 1587:      *          method is invoked to check read access to both files unless both
>> 1588:      *          paths locate the same file
> 
> This isn't quite right, the SM should be invoked when the paths are not equals.  I think the starting point is the SecurityException specified by isSameFile. It should say "... is invoked to check read access to both files when the two paths are not equal". The mismatch method will then follow with the same wording.

Changed in 1bd9436ad7567b96c1baa14489721d93d7e7a436.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/15350#discussion_r1300287563
PR Review Comment: https://git.openjdk.org/jdk/pull/15350#discussion_r1300287277


More information about the nio-dev mailing list