-
-
Notifications
You must be signed in to change notification settings - Fork 435
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
Applying immutable map in SentryEvent#setExtras
causes UnsupportedOperationException
#1357
Comments
@wzieba thanks for reporting and steps with repro, that's great. I'm not entirely sure that we should project our setters with We could check its type if Obviously a workaround would be using only non-immutable types for now, or appending the values using |
not sure if I should tag this as an |
I'll add my 2 cents: In general calling In my case I tried to write custom
instead of guessing what should I do if I don't know what's the proper way to address all concenrs, I just wanted to share you may want to treat this issue as making |
@mateuszkwiecinski I don't disagree, although some of the problems you've mentioned are already known and in the backlog. eg for better ideally, you'd not need to fiddle with these things, the SDK should do it automatically, in our protocol pretty much everything is nullable by default, we want to be as cheap as possible (memory footprint and JSON ser/deser, payload size over the wire etc). thanks for the feedback. |
after discussed internally, we'll work on that but along with other changes that improve the Kotlin experience overall, during Q2. fwiw the App does not crash if applying an immutable list/map/etc to SentryEvent, it drops the event though and it fails silently (it logs out if debug is enabled). |
Platform:
Device
API
: 26compileSdkVersion
: 30targetSdkVersion
: 30buildTools
: applied by Android Gradle PluginIDE:
4.2 beta 3
Build system:
6.7.1
Android Gradle Plugin:
4.2.0-beta03
Sentry Android Gradle Plugin:
Proguard/R8:
Platform installed with:
The version of the SDK:
4.3.0
I have the following issue:
When applying extra data by
Sentry#setExtra
and then applying extra data for a single event bySentryEvent#setExtras
withimmutable map
(fromKotlin
), I'm experiencingUnsupportedOperationException
as SDK tries to edit the immutable map that is passed.It crashes on the runtime as Java's method signatures will accept
immutable
Kotlin's map.Steps to reproduce:
I've prepared a reproduction repository.
To check it, please go to
SentryProxyTest
. Both of the use cases are tested there.You can also check the results of those tests on CI.
The test with mutable map passes while test with immutable map throws an exception
Actual result:
When applying extra with
MutableMap
everything works fine, the exception is not thrown. When applying extra withMap
(which is immutable),UnsupportedOperationException
is thrown.Expected result:
Sentry SDK should accept both the
mutable
andimmutable
types. Forimmutable
types, if editing is required, it should map aMap
tomutable
type.The text was updated successfully, but these errors were encountered: