RFR: 8360887: (fs) Files.getFileAttributeView returns unusable FileAttributeView if UserDefinedFileAttributeView unavailable (aix) [v4]

Alan Bateman alanb at openjdk.org
Tue Jul 1 06:28:47 UTC 2025


On Mon, 30 Jun 2025 20:57:54 GMT, Martin Doerr <mdoerr at openjdk.org> wrote:

>> We need to fix this wrong behavior on AIX and the test should catch it. Please review!
>> 
>> Returning null is required: https://github.com/openjdk/jdk/blob/c2d76f9844aadf77a0b213a9169a7c5c8c8f1ffb/src/java.base/share/classes/java/nio/file/spi/FileSystemProvider.java#L924
>
> Martin Doerr has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Fix typo in comment.

src/java.base/aix/classes/sun/nio/fs/AixFileSystemProvider.java line 55:

> 53:     }
> 54: 
> 55:     static boolean supportsUserDefinedFileAttributeView(Path obj) {

I assume this can be private.

test/jdk/java/nio/file/FileStore/Basic.java line 113:

> 111:         if (!store1.supportsFileAttributeView(UserDefinedFileAttributeView.class) &&
> 112:             Files.getFileAttributeView(dir, UserDefinedFileAttributeView.class) != null) {
> 113:             throw new RuntimeException("UserDefinedFileAttributeView not supported, getFileAttributeView should return null");

I think it's okay to extend FileStore/Basic.java but to test Files.getFileAttributeView works consistent will require changes to test each of supported views. We shouldn't be testing UserDefinedFileAttributeView in isolation here.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26021#discussion_r2176531171
PR Review Comment: https://git.openjdk.org/jdk/pull/26021#discussion_r2176527220


More information about the nio-dev mailing list