Increase test coverage and bug fix in JacksonEvent#6181
Merged
dlvenable merged 2 commits intoNov 4, 2025
Conversation
…odify input maps which may be immutable. Signed-off-by: David Venable <dlv@amazon.com>
KarstenSchnitter
previously approved these changes
Oct 17, 2025
KarstenSchnitter
left a comment
Collaborator
There was a problem hiding this comment.
One minor suggestion. Otherwise looks good to me.
Comment on lines
+164
to
+167
| if (!newKey.equals(key)) { | ||
| toAdd.put(newKey, value); | ||
| iterator.remove(); | ||
| replacementMap.put(newKey, value); | ||
| } else { | ||
| replacementMap.put(key, value); |
Collaborator
There was a problem hiding this comment.
Couldn't you just use the newKey in both cases now?
Member
Author
There was a problem hiding this comment.
Good call. I just pushed a new revision with this.
Signed-off-by: David Venable <dlv@amazon.com>
san81
reviewed
Oct 20, 2025
| final Map<String, String> mapToPut = Map.of(key, value); | ||
|
|
||
| final EventKey eventKey = new JacksonEventKey("myMap"); | ||
| event.put(eventKey, mapToPut, false); |
san81
reviewed
Oct 20, 2025
|
|
||
| void normalizeKeys(Map<String, Object> map) { | ||
| Map<String, Object> toAdd = new HashMap<>(); | ||
| private Map<String, Object> normalizeKeys(final Map<String, Object> map) { |
Collaborator
There was a problem hiding this comment.
Is it possible that there could be existing use cases that are functioning based on the expectation that the map they are passing gets modified?
Member
Author
There was a problem hiding this comment.
@san81 , Possibly, but I don't think we should support that. For example, if you create the Map in the builder that always copies.
san81
approved these changes
Nov 4, 2025
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.
Description
I noticed that there was some low test coverage in
JacksonEventfor putting maps along with support to rename invalid key characters. When I added the test coverage, I also found that this code path would fail in the inputMapis immutable because the code attempts to modify the map.This PR adds additional test coverage. It also fixes that bug by copying the map.
Issues Resolved
N/A
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.