Page MenuHomePhabricator

App crashes when syncing options for logged-in user.
Closed, ResolvedPublic1 Estimated Story Points

Description

To reproduce:

  • Open app and log in.

https://rink.hockeyapp.net/manage/apps/226649/app_versions/153/crash_reasons/163101986

java.lang.ClassCastException: java.lang.Double cannot be cast to java.lang.String
at org.wikipedia.useroption.dataclient.UserInfo.userjsOptions(UserInfo.java:30)
at org.wikipedia.useroption.sync.UserOptionSyncAdapter.download(UserOptionSyncAdapter.java:54)
at org.wikipedia.useroption.sync.UserOptionSyncAdapter.onPerformSync(UserOptionSyncAdapter.java:44)
at android.content.AbstractThreadedSyncAdapter$SyncThread.run(AbstractThreadedSyncAdapter.java:272)

Event Timeline

Dbrant renamed this task from Wikipedia Android app crashes trying to cast Double to String to App crashes when syncing options for logged-in user..Mar 31 2017, 7:23 AM
Dbrant triaged this task as Unbreak Now! priority.
Dbrant updated the task description. (Show Details)
Dbrant set the point value for this task to 1.
Dbrant added subscribers: Niedzielski, Mholloway.

This issue is also on prod but didn't start occurring until yesterday. I haven't been able to repro locally yet. https://rink.hockeyapp.net/manage/apps/226649/app_versions/153/crash_reasons/163101986

Change 345859 had a related patch set uploaded (by Niedzielski; owner: Sniedzielski):
[apps/android/wikipedia@master] Fix: add workaround for numeric userjs options

https://gerrit.wikimedia.org/r/345859

I believe the corresponding request is: https://meta.wikimedia.org/w/api.php?format=json&formatversion=2&action=query&meta=userinfo&uiprop=options. Here's an example from a working account:

...
"userjs-app-pref-font-size": "-4",
"userjs-app-pref-theme": "true",
...

And a nonworking one that crashes the app:

"userjs-app-pref-font-size": 0,
"userjs-app-pref-theme": "false",
...

You can see that font size is a string in one and a number in another. This seems like a change in the API although the docs are not specific:

https://www.mediawiki.org/wiki/API:Userinfo
https://www.mediawiki.org/wiki/API:Options

I've put a client side workaround but I'm ill and traveling today so feel free to cherry pick: https://gerrit.wikimedia.org/r/345859. FWIW, when the client writes the option back, the type changes back to a string:

...
        "userjs-app-pref-font-size": "0.0",
        "userjs-app-pref-theme": "false",
...

Change 345859 merged by jenkins-bot:
[apps/android/wikipedia@master] Fix: add workaround for numeric userjs options

https://gerrit.wikimedia.org/r/345859

ABorbaWMF subscribed.

Tested on a Pixel with Android 7.1.1 and Nexus 4 with Android 5.1 on the Beta App 2.5.191-beta-2017-03-31 and the production app 2.5.191.03-31

I was unable to reproduce the issue.

Tested on Wikipedia app 2.5.192-alpha-04-04 and devices Samsung SM-J120A Galaxy Express 3 (Android 6.0.1) and HTC Google Nexus 9 Tablet OP82100 (Android 6.0.1). As the videos below show I was not able to reproduce this issue so it might have been fixed.

Dbrant claimed this task.