LOG4J2-2530 Generalize check for MapMessage#250
Merged
carterkozak merged 1 commit intoapache:masterfrom Jan 14, 2019
Merged
Conversation
carterkozak
reviewed
Jan 10, 2019
| msg = (StringMapMessage) event.getMessage(); | ||
| MapMessage msg; | ||
| if (event.getMessage() instanceof MapMessage) { | ||
| msg = (MapMessage) event.getMessage(); |
Contributor
There was a problem hiding this comment.
Unfortunately this doesn't quite work because we cannot rely on casting map values to strings on line 82
Contributor
Author
There was a problem hiding this comment.
just remove the cast?
carterkozak
reviewed
Jan 10, 2019
| public String lookup(final LogEvent event, final String key) { | ||
| final Message msg = event.getMessage(); | ||
| if (msg instanceof StringMapMessage) { | ||
| if (msg instanceof MapMessage) { |
Contributor
There was a problem hiding this comment.
Appending Object values to the stringbuilder on 69 is potentially dangerous, MapMessage.get(String) works around this by taking advantage of ParameterFormatter.deepToString.
Contributor
|
Would you mind adding tests to make sure we don't reintroduce this regression? The implementation looks great :-) |
Contributor
Author
|
Will do that and the paperwork tomorrow or over the weekend.
…On Thu, Jan 10, 2019, 10:01 PM Carter Kozak ***@***.*** wrote:
Would you mind adding tests to make sure we don't reintroduce this
regression? The implementation looks great :-)
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#250 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACYiozC7E8VUeRVXCVqTnrGkcQ-6PLswks5vB6owgaJpZM4Z5wFh>
.
|
…ssage are logged as well as StringMapMessage and ohter subtypes
Contributor
Author
This PR can be merged and the issue can be closed, as far as I'm concerned. If there's something that needs to be done further on my part, please let me know. |
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.
This fixes LOG4J2-2530 by generalizing the check for
MapMessageto catch not onlyStringMapMessageobjects but alsoStructuredMapMessgageobjects, fixing an accidental breaking change introduced in 76aff58.