Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onUpdateRequestError invokes if CustomUpdateData contains an array #4

Open
daudrain opened this issue Apr 14, 2017 · 1 comment · May be fixed by #5
Open

onUpdateRequestError invokes if CustomUpdateData contains an array #4

daudrain opened this issue Apr 14, 2017 · 1 comment · May be fixed by #5
Assignees

Comments

@daudrain
Copy link

The library logs an exception and invoke onUpdateRequestError if Update's CustomUpdateData contains an array field. For example { "name": "pink_floyd", "category": "bird", "colors": [ "one", "two" ] }

The logged exception is

java.lang.ClassCastException: com.google.gson.JsonArray cannot be cast to com.google.gson.JsonObject
at io.barracks.ota.client.UpdateCheckService$DefaultBundleAdapter.jsonObjectToBundle(UpdateCheckService.java:314)
at io.barracks.ota.client.UpdateCheckService$DefaultBundleAdapter.read(UpdateCheckService.java:286)
at io.barracks.ota.client.UpdateCheckService$DefaultBundleAdapter.read(UpdateCheckService.java:236)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.read(ReflectiveTypeAdapterFactory.java:116)
at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.read(ReflectiveTypeAdapterFactory.java:216)
at retrofit2.converter.gson.GsonResponseBodyConverter.convert(GsonResponseBodyConverter.java:37)
at retrofit2.converter.gson.GsonResponseBodyConverter.convert(GsonResponseBodyConverter.java:25)
at retrofit2.ServiceMethod.toResponse(ServiceMethod.java:116)
at retrofit2.OkHttpCall.parseResponse(OkHttpCall.java:211)
at retrofit2.OkHttpCall.execute(OkHttpCall.java:174)
at retrofit2.ExecutorCallAdapterFactory$ExecutorCallbackCall.execute(ExecutorCallAdapterFactory.java:89)
at io.barracks.ota.client.UpdateCheckService.checkUpdate(UpdateCheckService.java:177)
at io.barracks.ota.client.UpdateCheckService.onHandleIntent(UpdateCheckService.java:138)
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:66)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:158)
at android.os.HandlerThread.run(HandlerThread.java:61)
@saiimons
Copy link
Contributor

saiimons commented Apr 14, 2017

@DavidAudrain you can checkout the branch, a few changes will be necessary to switch from a Bundle to a new type in both the request and response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants