Page MenuHomePhabricator

JSONException: Unterminated object
Closed, ResolvedPublic

Description

Seems to have begun with 2.0-r-2014-07-23
We're getting errors like these:
org.json.JSONException: Unterminated object at character 60 of
[some JSON]
at org.json.JSONTokener.syntaxError(JSONTokener.java:450)
at org.json.JSONTokener.readObject(JSONTokener.java:394)
at org.json.JSONTokener.nextValue(JSONTokener.java:100)
at org.json.JSONTokener.readObject(JSONTokener.java:385)
at org.json.JSONTokener.nextValue(JSONTokener.java:100)
at org.json.JSONObject.<init>(JSONObject.java:154)
at org.json.JSONObject.<init>(JSONObject.java:171)
at org.wikipedia.bridge.CommunicationBridge$CommunicatingChrome.onJsPrompt(CommunicationBridge.java
:117)
at android.webkit.CallbackProxy.handleMessage(CallbackProxy.java:617)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)

They all seem to be Japanese users of the app, and the text seems to be Japanese in every case I've seen so far.

https://ticket.wikimedia.org/otrs/index.pl?Action=AgentTicketZoom;TicketID=7688779
https://ticket.wikimedia.org/otrs/index.pl?Action=AgentTicketZoom;TicketID=7690999
https://ticket.wikimedia.org/otrs/index.pl?Action=AgentTicketZoom;TicketID=7691090
https://ticket.wikimedia.org/otrs/index.pl?Action=AgentTicketZoom;TicketID=7691772
https://ticket.wikimedia.org/otrs/index.pl?Action=AgentTicketZoom;TicketID=7693297
https://ticket.wikimedia.org/otrs/index.pl?Action=AgentTicketZoom;TicketID=7687247
https://ticket.wikimedia.org/otrs/index.pl?Action=AgentTicketZoom;TicketID=7691768
https://ticket.wikimedia.org/otrs/index.pl?Action=AgentTicketZoom;TicketID=7688124
https://ticket.wikimedia.org/otrs/index.pl?Action=AgentTicketZoom;TicketID=7692130


Version: Alpha
Severity: normal

Details

Reference
bz68656

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 3:39 AM
bzimport set Reference to bz68656.
bzimport added a subscriber: Unknown Object (MLST).
  • Bug 68735 has been marked as a duplicate of this bug. ***

Change 149883 had a related patch set uploaded by Dbrant:
Fix possible crash related to JSON encoding in clicking references.

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

https://ticket.wikimedia.org/otrs/index.pl?Action=AgentZoom&TicketID=7695568

Unterminated object at

character 55 of {"type":"referenceClicked","payload":{"ref":"<a rel=?"nofollow?"
class=?"external text?"
href=?"http://hubblesite.org/newscenter/archive/releases/1996/04/?">Hubble Space
Telescope Captures First Direct Image of a Star</a> - ハッブル宇宙望遠鏡サイト"}}

Found that one Japanese wiki page that has this reference link:
https://ja.wikipedia.org/wiki/%E3%83%99%E3%83%86%E3%83%AB%E3%82%AE%E3%82%A6%E3%82%B9#cite_note-13
(Betelgeuse on Japanese wiki)

Created a link on [[:test:TestLink]] to that since I had a hard time entering the title in the Wikipedia app on Android. Still can't reproduce this bug. Tried both English and Japanese system language.

Aha, a few of the crash reports actually make sense, such as these:

https://ticket.wikimedia.org/otrs/index.pl?Action=AgentTicketZoom;TicketID=7695690
https://ticket.wikimedia.org/otrs/index.pl?Action=AgentTicketZoom;TicketID=7695568

So, in these cases, the json data is definitely not being 'stringify'ed correctly across the bridge. But why?

Reproduced!!! (on my 4.1.2 tablet, with system language set to Japanese)

The patch linked above does indeed fix it. Should be in production soon.

Change 149883 merged by jenkins-bot:
Fix possible crash related to JSON transfer across the Bridge.

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