crisp-sdk-android icon indicating copy to clipboard operation
crisp-sdk-android copied to clipboard

JsonSyntaxException

Open pdprober opened this issue 2 years ago • 1 comments
trafficstars

android version

android 10

device

Redmi Note 7

SDK version

1.0.13

Log

Fatal Exception: com.google.gson.JsonSyntaxException: com.google.gson.stream.MalformedJsonException: Unterminated object at line 1 column 1305 path $.l at com.google.gson.Gson.fromJson(Gson.java:61) at com.google.gson.Gson.fromJson(Gson.java:4) at com.google.gson.Gson.fromJson(Gson.java:9) at com.google.gson.Gson.fromJson(Gson.java) at im.crisp.client.internal.h.m.readObject(m.java:10) at java.lang.reflect.Method.invoke(Method.java) at java.io.ObjectStreamClass.invokeReadObject(ObjectStreamClass.java:1066) at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:2013) at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1899) at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1412) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:427) at im.crisp.client.internal.b.a.q(a.java:30) at im.crisp.client.internal.b.a.(a.java:46) at im.crisp.client.internal.b.a.a(a.java:6) at im.crisp.client.Crisp.configure(Crisp.java:6)

pdprober avatar Dec 06 '22 02:12 pdprober

Hi @pdprober and thank you for your feedback.

I dived into this exception and unfortunately, I did not reproduced it :/ What I suspected was 2 fields which have been added in Website settings in 1.0.9 and 1.0.11 but deserializing it produced an InvalidClassException (already handled by the SDK as it is inheriting from IOException) and not a MalformedJsonException... So I assume there was an error while saving it instead but without more info, I cannot find the cause of the crash :/

However, in order to fix it, I now handle JsonParseException while deserializing (MalformedJsonException which is an IOException was encapsulated in it, this is why the SDK was not handling it...). No worries, if the Website settings cannot be read from the cache, it is automatically fetched upon socket connection. I also added Website settings log when this parsing exception occurs to get an insight of what is the cause.

It will be released in the next 1.0.14

Doc1faux avatar Dec 06 '22 15:12 Doc1faux

@pdprober 1.0.14 which should fix this issue has just been released. It can take a few hours before it will be available. I close the issue.

Doc1faux avatar Dec 29 '22 17:12 Doc1faux