Skip to content

Conversation

@fmeum
Copy link
Contributor

@fmeum fmeum commented Dec 31, 2025

FileSystemProvider.readAttributesIfExists now returns null for a path with a true prefix that is not a directory rather than throwing NotDirectoryException.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8374441: (fs) FileSystemProvider.readAttributesIfExists throws "Not a directory" when element in path is not directory should return null for ENOTDIR (unix) (Bug - P4)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/29013/head:pull/29013
$ git checkout pull/29013

Update a local copy of the PR:
$ git checkout pull/29013
$ git pull https://git.openjdk.org/jdk.git pull/29013/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 29013

View PR using the GUI difftool:
$ git pr show -t 29013

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/29013.diff

Using Webrev

Link to Webrev Comment

@fmeum fmeum changed the title Fix 8374441: Fix Dec 31, 2025
@bridgekeeper
Copy link

bridgekeeper bot commented Dec 31, 2025

👋 Welcome back fmeum! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Dec 31, 2025

@fmeum This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8374441: (fs) FileSystemProvider.readAttributesIfExists throws "Not a directory" when element in path is not directory should return null for ENOTDIR (unix)

Reviewed-by: alanb

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 20 new commits pushed to the master branch:

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

As you do not have Committer status in this project an existing Committer must agree to sponsor your change. Possible candidates are the reviewers of this PR (@AlanBateman) but any other Committer may sponsor as well.

➡️ To flag this PR as ready for integration with the above commit message, type /integrate in a new comment. (Afterwards, your sponsor types /sponsor in a new comment to perform the integration).

@openjdk openjdk bot added the nio nio-dev@openjdk.org label Dec 31, 2025
@openjdk
Copy link

openjdk bot commented Dec 31, 2025

@fmeum The following label will be automatically applied to this pull request:

  • nio

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@fmeum fmeum changed the title 8374441: Fix 8374441: Files.readAttributesIfExists should return null for ENOTDIR (unix) Dec 31, 2025
@fmeum fmeum changed the title 8374441: Files.readAttributesIfExists should return null for ENOTDIR (unix) 8374441: FileSystemProvider.readAttributesIfExists should return null for ENOTDIR (unix) Dec 31, 2025
@fmeum fmeum marked this pull request as ready for review January 1, 2026 06:49
@openjdk openjdk bot added the rfr Pull request is ready for review label Jan 1, 2026
@mlbridge
Copy link

mlbridge bot commented Jan 1, 2026

Webrevs

@fmeum
Copy link
Contributor Author

fmeum commented Jan 1, 2026

The linux-x64 debug build job consistently fails with "No space left on device", which doesn't appear to be related to this PR.

@AlanBateman
Copy link
Contributor

FileSystemProvider.readAttributesIfExists is part of the SPI so should be rare to see a direct usage. Instead, the usages are indirect, e.g. Files.isXXX to avoid using exceptions for control flow. Would it be possible to update the JBS issue or this PR with a some context as to how you ran into this. The implementation of APIs such as Files.isXXX will already handle the FileSystemException so the change should be transparent. I'm wondering if we've missed something in another usage (of some API) that causes the FileSystemException to surface.

@fmeum
Copy link
Contributor Author

fmeum commented Jan 2, 2026

I added more details to the JBS issue. Bazel would like to use the provider method directly so that it doesn't have to pay for the cost of an exception in the case where a file does not exist, but our tests show that the method still throws in some edge cases in which the file is considered missing by higher-level APIs.

@AlanBateman
Copy link
Contributor

Title mismatch between PR and JBS.

Can you update the PR title to match the JBS issue?

@fmeum fmeum changed the title 8374441: FileSystemProvider.readAttributesIfExists should return null for ENOTDIR (unix) 8374441: (fs) FileSystemProvider.readAttributesIfExists throws "Not a directory" when element in path is not directory should return null for ENOTDIR (unix) Jan 5, 2026
@fmeum fmeum requested a review from AlanBateman January 5, 2026 16:17
@fmeum fmeum requested a review from AlanBateman January 5, 2026 20:12
@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jan 6, 2026
@fmeum
Copy link
Contributor Author

fmeum commented Jan 6, 2026

/integrate

@openjdk openjdk bot added the sponsor Pull request is ready to be sponsored label Jan 6, 2026
@openjdk
Copy link

openjdk bot commented Jan 6, 2026

@fmeum
Your change (at version 868e0f4) is now ready to be sponsored by a Committer.

@AlanBateman
Copy link
Contributor

/sponsor

@openjdk
Copy link

openjdk bot commented Jan 6, 2026

Going to push as commit 2fbc416.
Since your change was applied there have been 21 commits pushed to the master branch:

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Jan 6, 2026
@openjdk openjdk bot closed this Jan 6, 2026
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review sponsor Pull request is ready to be sponsored labels Jan 6, 2026
@openjdk
Copy link

openjdk bot commented Jan 6, 2026

@AlanBateman @fmeum Pushed as commit 2fbc416.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

integrated Pull request has been integrated nio nio-dev@openjdk.org

Development

Successfully merging this pull request may close these issues.

2 participants