Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix edge case in JsonTemplateLayout with certain escaped sequences #2187

Merged
merged 4 commits into from
Jan 2, 2025

Conversation

jtduffy
Copy link
Contributor

@jtduffy jtduffy commented Dec 30, 2024

Resolves #2184

  • Use compiled regex pattern to detect un-escaped ", sequences
  • New unit tests

Regarding the use of regex, I ran several tests iterating over the getIndexToModifyJson method 1 million times, and the total time was around 450ms for each test.

meiao
meiao previously approved these changes Dec 30, 2024
@codecov-commenter
Copy link

codecov-commenter commented Jan 2, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.67%. Comparing base (9124406) to head (51a81f1).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##               main    #2187   +/-   ##
=========================================
  Coverage     70.67%   70.67%           
+ Complexity     9996     9995    -1     
=========================================
  Files           842      842           
  Lines         40363    40363           
  Branches       6116     6116           
=========================================
+ Hits          28525    28527    +2     
+ Misses         9084     9081    -3     
- Partials       2754     2755    +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jtduffy jtduffy merged commit fafe3de into main Jan 2, 2025
114 checks passed
@jtduffy jtduffy deleted the log4j-json-escape-string branch January 2, 2025 20:10
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Log4j JsonTemplateLayout w/ local decorating - Properly support escaped double quotes followed by a comma
3 participants