Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Avoid NPEs from SDK in API like setTag, setData, setContext #4245

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

adinauer
Copy link
Member

📜 Description

Using the SDK and having to guard against null is not a nice experience. Instead the SDK now tries to do the right thing when it receives null on APIs like setTag, setData, setContext, setExtra etc.

This means the SDK will:

  • NoOp if the key is null (maybe returning null if a return type is specified)
  • Unset the previous value if the value is set to null

💡 Motivation and Context

Fixes #4224

💚 How did you test it?

📝 Checklist

  • I added tests to verify the changes.
  • No new PII added or SDK only sends newly added PII if sendDefaultPII is enabled.
  • I updated the docs if needed.
  • I updated the wizard if needed.
  • Review from the native team if needed.
  • No breaking change or entry added to the changelog.
  • No breaking change for hybrid SDKs or communicated to hybrid SDKs.

🔮 Next steps

Copy link
Contributor

Fails
🚫 Please consider adding a changelog entry for the next release.

Instructions and example for changelog

Please add an entry to CHANGELOG.md to the "Unreleased" section. Make sure the entry includes this PR's number.

Example:

## Unreleased

- Avoid NPEs from SDK in API like setTag, setData, setContext ([#4245](https://github.com/getsentry/sentry-java/pull/4245))

If none of the above apply, you can opt out of this check by adding #skip-changelog to the PR description.

Generated by 🚫 dangerJS against 6fdd4e7

Copy link
Contributor

Performance metrics 🚀

  Plain With Sentry Diff
Startup time 389.13 ms 420.88 ms 31.75 ms
Size 1.58 MiB 2.21 MiB 642.23 KiB

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.

Span.setData / Transaction.setData cause NullPointerException
1 participant