baasbox / Android-SDK

BaasBox Android SDK
Apache License 2.0
27 stars 26 forks source link

ProtocolException if server is restarted and BaasUser is logged in #36

Open dirkam opened 9 years ago

dirkam commented 9 years ago

Seems to be the same issue as #32 but in a different scenario.

Steps to reproduce:

Login with a BaasBox User. Restart BaasBox server. Go to somewhere in the app where BaasBox server is called and it crashes with ProtocolException.

After crashing the app can be restarted and it works fine.

If Social Login is used then it doesn't crash as in this case the session token expires with restart and BaasInvalidSessionException is thrown, which can be handled correctly.

5.0.1 Lollipop.

java.lang.Error: Got a protocol exception while setting http method at com.baasbox.android.HttpUrlConnectionClient.setupConnectionForRequest(HttpUrlConnectionClient.java:244) at com.baasbox.android.HttpUrlConnectionClient.execute(HttpUrlConnectionClient.java:158) at com.baasbox.android.NetworkTask.asyncCall(NetworkTask.java:151) at com.baasbox.android.NetworkTask.parseResponse(NetworkTask.java:74) at com.baasbox.android.NetworkTask.asyncCall(NetworkTask.java:152) at com.baasbox.android.impl.Task.execute(Task.java:189) at com.baasbox.android.impl.Dispatcher$Worker.run(Dispatcher.java:170) Caused by: java.net.ProtocolException: content-length promised 17 bytes, but received 0 at com.android.okhttp.internal.http.RetryableSink.close(RetryableSink.java:50) at com.android.okio.RealBufferedSink.close(RealBufferedSink.java:174) at com.android.okio.RealBufferedSink$1.close(RealBufferedSink.java:142) at com.baasbox.android.HttpUrlConnectionClient.copyStream(HttpUrlConnectionClient.java:266) at com.baasbox.android.HttpUrlConnectionClient.addBody(HttpUrlConnectionClient.java:252) at com.baasbox.android.HttpUrlConnectionClient.setupConnectionForRequest(HttpUrlConnectionClient.java:228) at com.baasbox.android.HttpUrlConnectionClient.execute(HttpUrlConnectionClient.java:158) at com.baasbox.android.NetworkTask.asyncCall(NetworkTask.java:151) at com.baasbox.android.NetworkTask.parseResponse(NetworkTask.java:74) at com.baasbox.android.NetworkTask.asyncCall(NetworkTask.java:152) at com.baasbox.android.impl.Task.execute(Task.java:189) at com.baasbox.android.impl.Dispatcher$Worker.run(Dispatcher.java:170)

dirkam commented 9 years ago

This issue is still open, crash guaranteed on Lollipop+ devices. Could you please take a look at it?

eliantor commented 9 years ago

Hi,

as soon as I can, I'm sorry but we are currently very busy.

dirkam commented 9 years ago

Thank you very much.