fix: handle boolean return value from File.delete() in Enunciate#6
Open
sonarqube-agent[bot] wants to merge 1 commit into
Open
fix: handle boolean return value from File.delete() in Enunciate#6sonarqube-agent[bot] wants to merge 1 commit into
sonarqube-agent[bot] wants to merge 1 commit into
Conversation
Fixed issues: - AZZmtiWq2HDYqP_XyoAn for java:S899 rule Generated by SonarQube Agent (task: 7ce5db39-7aa2-4d0b-a296-e574076e6051)
SonarQube reviewer guide
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.




Addressed SonarQube issue S899 by properly checking the boolean return value of tempDir.delete(). The fix wraps the delete call in a conditional check and logs a warning when deletion fails, ensuring file operations are properly validated instead of ignoring potential failures.
View Project in SonarCloud
Fixed Issues
java:S899 - Do something with the "boolean" value returned by "delete". • MINOR • View issue
Location:
core/src/main/java/com/webcohesion/enunciate/Enunciate.java:288Why is this an issue?
When the return value of a function call contains the operation status code, this value should be tested to make sure the operation completed successfully.
What changed
This hunk fixes the bug where the boolean return value of
tempDir.delete()was being ignored. The static analysis rule requires that the status code returned byjava.io.Fileoperations likedelete()must be checked. The fix wraps the call in anif (!tempDir.delete())check and logs a warning message when the deletion fails, ensuring the return value is properly handled.SonarQube Remediation Agent uses AI. Check for mistakes.