FileUtils.deleteDirectory could throw UncheckedIOException#478
Closed
jglick wants to merge 2 commits into
Closed
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #478 +/- ##
============================================
- Coverage 84.79% 84.75% -0.04%
Complexity 3364 3364
============================================
Files 227 227
Lines 8076 8083 +7
Branches 953 953
============================================
+ Hits 6848 6851 +3
- Misses 974 978 +4
Partials 254 254 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
elharo
approved these changes
Oct 3, 2023
elharo
left a comment
Contributor
There was a problem hiding this comment.
Thanks for catching this. This is pretty bad.
There's probably more work to be done. I'm not sure I've ever seen a case where UncheckedIOException is anything other than a bug.
elharo
approved these changes
Oct 3, 2023
elharo
left a comment
Contributor
There was a problem hiding this comment.
Filed https://issues.apache.org/jira/browse/IO-814 to track this
Contributor
|
#491 fixed this so this PR can be closed |
Member
|
Closing per previous comment. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
At some point between 2.11.0 and 2.13.0, I think as of 323d376, there seems to have been an incompatible change due to use of
UncheckedIOException. I found the following from a piece of code callingFileUtils.deleteDirectoryand catching and loggingIOException, which failed to catch the runtime exception:Never mind the exact reason for the failure of
Files.readAttributes; something to do with NFS I think. The point is thatdeleteDirectoryshould either succeed, or throw some subtype ofIOException. Reproduced similar behavior in the unit test prior tosrc/main/fix:I attempted to track all direct or indirect callers of
PathUtils.readAttributesand make sure they either documentedUncheckedIOExceptionor translated it toIOException. I did not attempt to do the same for the many other uses ofUncheck.