Skip to content

ArrayOutOfBoundsException when using Field.getName #241

Closed
@kaeawc

Description

@kaeawc

During initialization the SDK users some reflection here

I've observed a couple occurrences where this can result in an ArrayOutOfBoundsException. I have very little insight or understanding of the internals of Art, but it seems like it could be safe to catch that exception as well.

Here's the stacktrace from an app using Mixpanel SDK 4.6.1

java.lang.RuntimeException: Unable to create application <redacted>: java.lang.ArrayIndexOutOfBoundsException: length=15; index=56585
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4720)
at android.app.ActivityThread.access$1600(ActivityThread.java:163)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1419)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5536)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1397)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1192)
Caused by: java.lang.ArrayIndexOutOfBoundsException: length=15; index=56585
at java.lang.reflect.ArtField.getNameNative(Native Method)
at java.lang.reflect.ArtField.getName(ArtField.java:91)
at java.lang.reflect.Field.getName(Field.java:122)
at com.mixpanel.android.mpmetrics.ResourceReader.readClassIds(ResourceReader.java:89)
at com.mixpanel.android.mpmetrics.ResourceReader.initialize(ResourceReader.java:120)
at com.mixpanel.android.mpmetrics.ResourceReader$Ids.<init>(ResourceReader.java:23)
at com.mixpanel.android.viewcrawler.ViewCrawler$ViewCrawlerHandler.<init>(ViewCrawler.java:283)
at com.mixpanel.android.viewcrawler.ViewCrawler.<init>(ViewCrawler.java:78)
at com.mixpanel.android.mpmetrics.MixpanelAPI.constructUpdatesFromMixpanel(MixpanelAPI.java:1330)
at com.mixpanel.android.mpmetrics.MixpanelAPI.<init>(MixpanelAPI.java:218)
at com.mixpanel.android.mpmetrics.MixpanelAPI.getInstance(MixpanelAPI.java:288)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions