Conversation
- Heaplets: use the SLF4J "{}" placeholder instead of "%s", so the
warning names the class that could not be instantiated
- ResolveLocationJsonValueFunction: use "%s" in String.format() instead
of "{}", so the exception reports the $location value
- PolicyEnforcementFilter: add the missing placeholder for the request
URI in the "returned resource does not match" error
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.
Closes code scanning alerts #29, #30, #31 (
java/unused-format-argument, warning). All three are real message bugs: the argument was supplied but never rendered.Heaplets.javalogger.warn("… instantiate %s as a Heaplet", c.getName(), e)— SLF4J logs a literal%s, the class name is lost{}ResolveLocationJsonValueFunction.javaString.format("$location value ({}) cannot be null …", …)— exception message shows a literal{}%sPolicyEnforcementFilter.java"Returned resource ('{}' does not match current request URI (''))"— second placeholder missing,originalnever printed, unbalanced parentheses('{}') … ('{}')Tests added:
HeapletsTest.shouldLogClassNameWhenHeapletCannotBeInstantiated— captures the WARN with a logbackListAppendervia a heaplet whose constructor throws; failed before the fix with…instantiate [%s] as a Heaplet.ResolveLocationJsonValueFunctionTest.shouldReportTheValueWhenLocationIsNull— failed before the fix with$location value ({}) cannot be null ….No test for #31:
openig-openamruns its tests onslf4j-nop, so the log line cannot be captured without adding a logging backend to the module's test dependencies; the change is confined to the format string of a// Should never happenbranch.