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: for #6374 to delete non-empty directories #6375

Merged
merged 1 commit into from
Jan 9, 2024

Conversation

sellersj
Copy link
Contributor

@sellersj sellersj commented Jan 9, 2024

Fixes Issue #6374

Description of Change

Walk the files to delete using just java.

Have test cases been added to cover the new functionality?

yes

@boring-cyborg boring-cyborg bot added tests test cases utils changes to utils labels Jan 9, 2024
@sellersj sellersj changed the title for #6374 to delete non-empty directories fix: for #6374 to delete non-empty directories Jan 9, 2024
Copy link
Owner

@jeremylong jeremylong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jeremylong
Copy link
Owner

Thank you for reporting and fixing the issue. Really appreciate this.

@jeremylong jeremylong merged commit ce29982 into jeremylong:main Jan 9, 2024
6 of 7 checks passed
@jeremylong jeremylong added this to the 9.0.9 milestone Jan 9, 2024
@@ -91,7 +91,10 @@ public static boolean delete(@Nullable File file) {
}

try {
Files.delete(file.toPath());
Files.walk(file.toPath())

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The stream returned by Files.walk should be closed.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting... most streams don't need to be closed like this; as documented in the Stream javadoc. Hadn't thought about this possibly being tied to an IO channel. Turns out this isn't uncommon: https://sourcegraph.com/search?q=context:global+content:%22try+%28Stream%3CPath%3E+paths+%3D+Files.walk%28%22+lang:java&patternType=standard&sm=1&groupBy=repo

Fixed with #6382

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tests test cases utils changes to utils
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants