alibaba / fastjson

FASTJSON 2.0.x has been released, faster and more secure, recommend you upgrade.
https://github.com/alibaba/fastjson2/wiki/fastjson_1_upgrade_cn
Apache License 2.0
25.75k stars 6.5k forks source link

java.lang.ClassCastException #1622

Open jolly336 opened 6 years ago

jolly336 commented 6 years ago

并发请求几个接口,fastjson序列化就会出现java.lang.ClassCastException异常,像这种错误Fatal Exception: java.lang.ClassCastException: com.nelson.demo.model.CarListModel cannot be cast to com.nelson.demo.model.TaskListModel
版本:com.alibaba:fastjson:1.1.60.android

wenshao commented 6 years ago

能提供完整堆栈信息么?

jolly336 commented 6 years ago

截取了fabric线上的,页面并发请求几个接口就会出现,现在在callback做了try{}catch()处理了 Fatal Exception: java.lang.ClassCastException: com.guazi.crm.business.seller.model.CarSourceOptionModel cannot be cast to com.guazi.crm.business.seller.model.CarSourceListModel at com.guazi.android.sales.base.vl.activity.CarSourceFragment$8.onChanged(CarSourceFragment.java:451) at com.guazi.android.sales.base.vl.activity.CarSourceFragment$8.onChanged(CarSourceFragment.java:446) at android.arch.lifecycle.LiveData.considerNotify(LiveData.java:131) at android.arch.lifecycle.LiveData.dispatchingValue(LiveData.java:148) at android.arch.lifecycle.LiveData.setValue(LiveData.java:294) at android.arch.lifecycle.MutableLiveData.setValue(MutableLiveData.java:33) at com.guazi.crm.business.common.source.CarSourceRepository$2.onSuccess(CarSourceRepository.java:49) at com.guazi.crm.business.common.oknet.retrofitapi.base.ResponseCallback.onResponse(ResponseCallback.java:51) at retrofit2.ExecutorCallAdapterFactory$ExecutorCallbackCall$1$1.run(ExecutorCallAdapterFactory.java:68) at android.os.Handler.handleCallback(Handler.java:743) at android.os.Handler.dispatchMessage(Handler.java:95) at android.os.Looper.loop(Looper.java:150) at android.app.ActivityThread.main(ActivityThread.java:5665) at java.lang.reflect.Method.invoke(Method.java) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:822) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:712)