Skip to content

Fix NIO error handling in visible and non-empty file filters (f009) - #894

Merged
garydgregory merged 2 commits into
apache:masterfrom
garydgregory:fix/f009_io_filter_stream_exception
Oct 19, 2026
Merged

garydgregory merged 2 commits into
apache:masterfrom
garydgregory:fix/f009_io_filter_stream_exception

Conversation

@garydgregory

Copy link
Copy Markdown
Member

Fix NIO error handling in visible and non-empty file filters (f009)

Negate status predicates before handling IOException so VISIBLE and NOT_EMPTY reject paths whose status cannot be determined.

Reuse PathUtils.isEmptyDirectory() for directory checks while preserving null and classic File behavior. Document the behavior and add regression tests for status, directory-open, directory-close, and missing-path errors.

  • Read the contribution guidelines for this project.
  • Read the ASF Generative Tooling Guidance if you use Artificial Intelligence (AI).
  • I used AI to review the bug report and create an initial solution, and revise it a few times.
  • Run a successful build using the default Maven goal with mvn; that's mvn on the command line by itself.
  • Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied. This may not always be possible, but it is a best practice.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Each commit in the pull request should have a meaningful subject line and body. Note that a maintainer may squash commits during the merge process.

Negate status predicates before handling IOException so VISIBLE and
NOT_EMPTY reject paths whose status cannot be determined.

Reuse PathUtils.isEmptyDirectory() for directory checks while preserving
null and classic File behavior. Document the behavior and add regression
tests for status, directory-open, directory-close, and missing-path
errors.
Unwrap DirectoryIteratorException so the existing IOException handler
rejects paths whose empty status cannot be determined.

Document the behavior and add regression coverage for both filters,
matches(), stream closure, and subclass error-handler behavior.
@garydgregory
garydgregory merged commit f7e3b92 into apache:master Oct 19, 2026
24 checks passed
@garydgregory
garydgregory deleted the fix/f009_io_filter_stream_exception branch October 19, 2026 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant