Page MenuHomePhabricator

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


To reproduce:

  • Open app and log in.

java.lang.ClassCastException: java.lang.Double cannot be cast to java.lang.String
at org.wikipedia.useroption.dataclient.UserInfo.userjsOptions(
at org.wikipedia.useroption.sync.UserOptionSyncAdapter.onPerformSync(
at android.content.AbstractThreadedSyncAdapter$

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.

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

I believe the corresponding request is: 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:

I've put a client side workaround but I'm ill and traveling today so feel free to cherry pick: 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

ABorbaWMF added a subscriber: ABorbaWMF.

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

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.