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

Incorrect handling of file deletion in File-based writers #4203

Closed
wants to merge 1 commit into from

Conversation

marschall
Copy link
Contributor

Check the return value of File.delete() and throw an exception if deleting a file fails.

This fixes a well known bug pattern

RV: Method ignores exceptional return value (RV_RETURN_VALUE_IGNORED_BAD_PRACTICE)

This method returns a value that is not checked. The return value should be checked since it can indicate an unusual or unexpected function execution. For example, the File.delete() method returns false if the file could not be successfully deleted (rather than throwing an Exception). If you don't check the result, you won't notice if the method invocation signals unexpected behavior by returning an atypical return value.

Check the return value of File.delete() and throw an exception if deleting a
file fails.
@fmbenhassine fmbenhassine changed the title Check the return value of File.delete() Incorrect handling of file deletion in File-based writers Feb 13, 2023
@fmbenhassine fmbenhassine added this to the 5.0.1 milestone Feb 13, 2023
fmbenhassine pushed a commit that referenced this pull request Feb 13, 2023
Check the return value of File.delete() and
throw an exception if deleting a file fails.

Issue #4203
@fmbenhassine
Copy link
Contributor

Rebased and merged as 8c7fb5c. Thank you!

@fmbenhassine fmbenhassine added the for: backport-to-4.3.x Issues that will be back-ported to the 4.3.x line label Feb 13, 2023
fmbenhassine pushed a commit that referenced this pull request Feb 13, 2023
Check the return value of File.delete() and
throw an exception if deleting a file fails.

Issue #4203
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: backport-to-4.3.x Issues that will be back-ported to the 4.3.x line in: infrastructure pr-for: bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants