I get below Findbugs error for my code below. please let me know what do you need to do for this?
Code:
public void myMethod(Key key, long timestampMillis) { File file = createFile(key, timestampMillis); boolean deleted = file.delete(); }
<<Package/classname>> ignores the exclusive return value java.io.File.delete() This method returns a value that is not checked. The return value should be checked, as it may indicate an unusual or unexpected execution of the function. For example, the File.delete () method returns false if the file cannot be successfully deleted (instead of throwing an exception). If you do not check the result, you will not notice if the method call causes unexpected behavior, returning an atypical return value.
source share