Skip to content

fix(protocol): Allow Contexts.setProfile(null) to clear the profile context - #6684

Merged
runningcode merged 2 commits into
9.x.xfrom
no/java-705-profilecontext-nullable-setter
Nov 19, 2026
Merged

runningcode merged 2 commits into
9.x.xfrom
no/java-705-profilecontext-nullable-setter

Conversation

@runningcode

Copy link
Copy Markdown
Contributor

📜 Description

Contexts.setProfile takes a @Nullable ProfileContext but called Objects.requireNonNull on it, so passing null threw. This drops the check: setProfile(null) now removes the profile context, the same way Contexts.put treats a null value for any other key.

💡 Motivation and Context

The annotation and the runtime check disagreed. The profile context is only present while a continuous profile runs, so @Nullable is the intended contract.

💚 How did you test it?

Added a ContextsTest case that sets a profile context, then sets null, and checks it is gone.

📝 Checklist

  • I added GH Issue ID & Linear ID
  • 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.
  • Public API changes reviewed by another Mobile SDK team member or implemented according to the develop docs spec.

🤖 Generated with Claude Code

runningcode and others added 2 commits November 19, 2026 16:51
…ontext

setProfile takes a @nullable ProfileContext but threw on null. Drop
the requireNonNull so a null argument removes the profile context,
the same as Contexts.put does for any other key.

Fixes JAVA-705

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@linear-code

linear-code Bot commented Nov 19, 2026

Copy link
Copy Markdown

JAVA-705

@github-actions github-actions Bot added the risk: medium PR risk score: medium label Nov 19, 2026
@github-actions

Copy link
Copy Markdown
Contributor

PR risk: medium

For commit b514698.

Main concerns: reach, public contract, data sent to Sentry.

This label is a hint for reviewers, not an approval.

@runningcode
runningcode marked this pull request as ready for review November 19, 2026 15:52
@runningcode
runningcode requested review from a team and adinauer as code owners November 19, 2026 15:52
@runningcode
runningcode requested review from 0xadam-brown and markushi and removed request for a team November 19, 2026 15:52
@github-actions github-actions Bot added risk: medium PR risk score: medium and removed risk: medium PR risk score: medium labels Nov 19, 2026
@sentry

sentry Bot commented Nov 19, 2026

Copy link
Copy Markdown

📲 Install Builds

Android

🔗 App Name App ID Version Configuration
SDK Size io.sentry.tests.size 8.64.0 (1) release

⚙️ sentry-android Build Distribution Settings

@runningcode
runningcode merged commit 7db1e42 into 9.x.x Nov 19, 2026
42 of 43 checks passed
@runningcode
runningcode deleted the no/java-705-profilecontext-nullable-setter branch November 19, 2026 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: medium PR risk score: medium

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants