spring-batch icon indicating copy to clipboard operation
spring-batch copied to clipboard

Check the return value of File.delete()

Open marschall opened this issue 3 years ago • 0 comments

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.

marschall avatar Oct 03 '22 20:10 marschall