Skip to content

Fixed NPE when MDC contains null values. - #1364

Merged
marandaneto merged 7 commits into
getsentry:mainfrom
donbeave:main
Apr 1, 2021
Merged

Fixed NPE when MDC contains null values.#1364
marandaneto merged 7 commits into
getsentry:mainfrom
donbeave:main

Conversation

@donbeave

Copy link
Copy Markdown
Contributor

This is a fix for this issue: #1361.

@marandaneto

Copy link
Copy Markdown
Contributor

@donbeave thanks for contributing.
run make format and commit the changes, also add an entry to the changelog, thanks.

@codecov-io

codecov-io commented Mar 30, 2021

Copy link
Copy Markdown

Codecov Report

Merging #1364 (00a5613) into main (1d778b5) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##               main    #1364      +/-   ##
============================================
- Coverage     75.70%   75.69%   -0.01%     
- Complexity     1854     1858       +4     
============================================
  Files           185      185              
  Lines          6355     6362       +7     
  Branches        635      635              
============================================
+ Hits           4811     4816       +5     
- Misses         1256     1258       +2     
  Partials        288      288              
Impacted Files Coverage Δ Complexity Δ
...rc/main/java/io/sentry/logback/SentryAppender.java 90.00% <100.00%> (+0.25%) 25.00 <2.00> (+2.00)
sentry/src/main/java/io/sentry/HubAdapter.java 5.26% <0.00%> (-3.51%) 3.00% <0.00%> (-1.00%)
...c/main/java/io/sentry/ShutdownHookIntegration.java 100.00% <0.00%> (ø) 7.00% <0.00%> (+3.00%)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1d778b5...00a5613. Read the comment docs.

Comment thread CHANGELOG.md Outdated
donbeave and others added 3 commits March 31, 2021 19:27
Co-authored-by: Manoel Aranda Neto <5731772+marandaneto@users.noreply.github.com>
// remove keys with null values, there is no sense to send these keys to Sentry
final Map<String, String> mdcProperties =
CollectionUtils.shallowCopy(loggingEvent.getMDCPropertyMap());
loggingEvent.getMDCPropertyMap().entrySet().stream()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mind doing the same fix for log4j2 SentryAdapter? it's pretty much the same thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants