Repository navigation
Conversation
Sonar flagged four cleanup sites that call File.delete() but ignore the boolean return value (rule java:S899). When delete() returns false the file silently survives, which over time can produce disk leaks of trust stores, resolved references, and uploaded artifacts. Each site now logs a warning when delete() fails so the leak becomes diagnosable from production logs. - minions/async WebSocketMessageConsumptionTask#close (L128): warn when the WebSocket trust store cannot be deleted. - webapp ReferenceResolver#cleanResolvedReferences (L187): warn for each resolved reference file that fails to delete. - webapp UploadArtifactController#importArtifactFromUrl (L111): warn when the temporary artifact downloaded from a URL cannot be deleted in the finally block. - webapp UploadArtifactController#importArtifact (L156): same for the multipart-uploaded artifact. UploadArtifactController uses a SafeLogger whose warn(...) overloads only accept (String) and (String, Throwable), so the warning is emitted via plain string concatenation rather than slf4j placeholder substitution. Behaviour is unchanged on the happy path; failed deletions previously produced no signal at all. Signed-off-by: Git-HimanshuRathi <[email protected]>
The previous commit used slf4j-style '{}' placeholder syntax with
WebSocketMessageConsumptionTask's JBoss Logger, which only exposes
warn(Object), warn(Object, Throwable) and warn(Object, Object[]) -
no (String, Object) overload - so CI compilation failed.
Switch to JBoss Logger#warnf with printf-style '%s', matching the
existing convention in the same file (e.g. logger.errorf at L98).
Signed-off-by: Git-HimanshuRathi <[email protected]>
lbroudoux
requested changes
May 4, 2026
lbroudoux
left a comment
Member
There was a problem hiding this comment.
Just a small change to avoid future issues about not using the templatized form of log messages. Thanks a lot!
…ilures @lbroudoux's review on this PR pointed out that the warning emitted on File.delete() failure should use SafeLogger's templated form with '{}' rather than string concatenation, to stay consistent with the rest of the file. SafeLogger.warn(...) only exposed (String) and (String, Throwable) - the placeholder overloads existed for debug, info and error but not for warn. Add the three missing warn overloads ((String, Object), (String, Object, Object) and (String, Object...)), each going through the existing encode(...) sanitiser exactly like the equivalent info overloads, so user-controlled data still gets newline-encoded before being passed down to the underlying SLF4J logger. Switch the two File.delete() warning sites in UploadArtifactController to the '{}' templated form now that the API supports it. Signed-off-by: Git-HimanshuRathi <[email protected]>
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.
Sonar flagged four cleanup sites that call
File.delete()but ignore the boolean return value (rulejava:S899). Whendelete()returns false the file silently survives, which over time produces disk leaks of trust stores, resolved references, and uploaded artifacts. Each site now logs a warning whendelete()fails so the leak is diagnosable from production logs.Description
minions/async—WebSocketMessageConsumptionTask#close(L128): warn when the WebSocket trust store cannot be deleted.webapp—ReferenceResolver#cleanResolvedReferences(L187): warn for each resolved reference file that fails to delete.webapp—UploadArtifactController#importArtifactFromUrl(L111): warn when the temporary artifact downloaded from a URL cannot be deleted in thefinallyblock.webapp—UploadArtifactController#importArtifact(L156): same for the multipart-uploaded artifact.UploadArtifactControlleruses aSafeLoggerwhosewarn(...)overloads only accept(String)and(String, Throwable), so the warning is emitted via plain string concatenation rather than slf4j placeholder substitution.mvn spotless:check -pl minions/async,webapppasses locally.Related issue(s)
See also #2058