Skip to content

Conversation

@jamesnrokt
Copy link
Collaborator

Instructions

  • Using SetUserTag would cause Attempt to invoke virtual method 'java.lang.String java.lang.Object.toString()' on a null object reference

Summary

  • Perform null check before adding to final attributes

Testing Plan

  • Was this tested locally? If not, explain why.
  • Tested as part of the Maui integration

Reference Issue (For mParticle employees only. Ignore if you are an outside contributor)

  • Closes N/A

@jamesnrokt jamesnrokt requested a review from a team as a code owner October 14, 2025 03:17
Comment on lines +219 to +221
if (value != null) {
finalAttributes[key] = value.toString()
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Good catch @jamesnrokt . One question - In MP, we can set an attribute directly to be null using these user tags. In the example on our docs, https://docs.mparticle.com/developers/client-sdks/android/users/#set-user-tags, it uses platinum_member: NULL as the example.

In Rokt, is null not a valid value, and so we skip the setting of those attributes, as opposed to having the option to set them as null?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you also add a test for passing a null value?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added a test for passing in a null value

I believe Rokt doesn't use null values. For something like platinum_member we'd do key value "membershipLevel": "platinum"

Copy link
Collaborator

@rmi22186 rmi22186 left a comment

Choose a reason for hiding this comment

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

LGTM - just failing a check due to the workflow not being updated to permit PR-ing to main, but no big deal.

@jamesnrokt
Copy link
Collaborator Author

Thanks Rob

LGTM - just failing a check due to the workflow not being updated to permit PR-ing to main, but no big deal.

Already have a PR in place for that check: mParticle/mparticle-workflows#88

@jamesnrokt jamesnrokt merged commit 195cab2 into main Oct 20, 2025
16 of 17 checks passed
@jamesnrokt jamesnrokt deleted the fix/null-string branch October 20, 2025 22:04
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