Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update CloudStorageFileSystemProvider#getFileAttributeView to return null rather than throw UnsupportedOperationException #1427

Merged
merged 2 commits into from
Jun 25, 2024

Conversation

BenWhitehead
Copy link
Collaborator

Currently, when CloudStorageFileSystemProvider#getFileAttributeView is invoked with a class it doesn't recognize it throws an UnsupportedOperationException. The javadocs for FileSystemProvider, however specify that #getFileAttributeView[1] return null if the attribute view type is not available.

This change updates the behavior of CloudStorageFileSystemProvider#getFileAttributeView to return null rather than throw an exception.

Fixes #1424

[1] https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/nio/file/spi/FileSystemProvider.html#getFileAttributeView(java.nio.file.Path,java.lang.Class,java.nio.file.LinkOption...)

…turn null rather than throw UnsupportedOperationException

Currently, when CloudStorageFileSystemProvider#getFileAttributeView is invoked with a class it doesn't recognize it throws an UnsupportedOperationException. The javadocs for FileSystemProvider, however specify that #getFileAttributeView[1] return null if the attribute view type is not available.

This change updates the behavior of CloudStorageFileSystemProvider#getFileAttributeView to return null rather than throw an exception.

Fixes #1424

[1] https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/nio/file/spi/FileSystemProvider.html#getFileAttributeView(java.nio.file.Path,java.lang.Class,java.nio.file.LinkOption...)
@BenWhitehead BenWhitehead added the owlbot:ignore instruct owl-bot to ignore a PR label Jun 25, 2024
@BenWhitehead BenWhitehead requested a review from a team as a code owner June 25, 2024 16:13
@product-auto-label product-auto-label bot added size: s Pull request size is small. api: storage Issues related to the googleapis/java-storage-nio API. labels Jun 25, 2024
@sydney-munro
Copy link
Contributor

I trust you will sort out the broken unit test before merging

@BenWhitehead BenWhitehead merged commit b9e0362 into main Jun 25, 2024
21 checks passed
@BenWhitehead BenWhitehead deleted the fix-1424 branch June 25, 2024 18:38
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: storage Issues related to the googleapis/java-storage-nio API. owlbot:ignore instruct owl-bot to ignore a PR size: s Pull request size is small.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CloudStorageFileSystemProvider throwing exception with java 21
2 participants