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

Span.setData / Transaction.setData cause NullPointerException #4224

Open
adinauer opened this issue Mar 4, 2025 · 2 comments
Open

Span.setData / Transaction.setData cause NullPointerException #4224

adinauer opened this issue Mar 4, 2025 · 2 comments
Assignees

Comments

@adinauer
Copy link
Member

adinauer commented Mar 4, 2025

Integration

sentry

Java Version

any

Version

v7 + v8

Steps to Reproduce

  • setData(null, "x")
  • setData("x", null)
  • setData(null, null)

all of these cause an NPE

Expected Result

just NoOp in that case (OTel also does that)

we can consider unsetting any current data with the same key, if a null value is set

Actual Result

NPE

@adinauer
Copy link
Member Author

adinauer commented Mar 4, 2025

There's more places in the SDK where we do not accept null or even accept null and would cause NPE

  • Contexts.set...
  • SpanContext.setTag
  • SpanContext.setData

there's likely more, we should search for usages of ConcurrentHashMap

@stefanosiano stefanosiano moved this from Needs Discussion to Todo in Mobile & Cross Platform SDK Mar 5, 2025
@stefanosiano
Copy link
Member

we can consider unsetting any current data with the same key, if a null value is set

Agree on this

@adinauer adinauer self-assigned this Mar 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo
Development

No branches or pull requests

3 participants