[IO-874] FileUtils.forceDelete can delete a broken symlink again #756
+37
−1
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.
The fix for https://issues.apache.org/jira/browse/IO-859 introduced this regression bug https://issues.apache.org/jira/browse/IO-874, which is triggered when a broken/dangling symlink is tried to be deleted.
Before 2.16.1, FileUtils.forceDelete() deleted broken/dangling symbolic links successfully, since then it throws FileNotFoundException. With this fix a FileNotFoundException is only thrown, when the target file does not exist AND is not a symlink. 2 tests have been added to check that a broken link is deleted and that an ok link only deletes the link but not the file itself (increase test coverage).
Note: This is my first contribution. I just signed the ICLA as JoergBudi@gmx.de, shared it with secretary@apache.org and got a receipt, but haven't got an apacheid yet (my preferred apacheid would be jbudi , but I am in no hurry in case that is handed out only after more contribs).