Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
320 views
in Technique[技术] by (71.8m points)

bug retrofit.RetrofitError: java.io.EOFException for Android

I search a lot, I found some solutions like this:

System.setProperty("http.keepAlive", "false");
arg0.addHeader("Connection", "close");
arg0.addHeader("Accept-Language", "en-US,en;q=0.8");

I try them but didn't work for me. How can I correct this bug? Here is my log:

D/Retrofit(28969): ---> 
    HTTP POST http://release.api.jeunesse.build.indus.ftven.net/app.php/api/users
D/Retrofit(28969): Connection: close
D/Retrofit(28969): Content-Type: application/json
D/Retrofit(28969): Content-Length: 169
D/Retrofit(28969): {"birthday":"2010-06-05T12:16:42+0200", 
  "devices":[{"device":"ae045e7bead6f933487a237f8b5f298d","primary":true}],
  "email":"[email protected]","login":"test9","password":"9876"}
D/Retrofit(28969): ---> END HTTP (169-byte body)
D/Retrofit(28969): ---- 
    ERROR http://release.api.jeunesse.build.indus.ftven.net/app.php/api/users
D/Retrofit(28969): java.io.EOFException
D/Retrofit(28969):     at libcore.io.Streams.readAsciiLine(Streams.java:203)
D/Retrofit(28969):     at libcore.net.http.HttpEngine.readResponseHeaders(HttpEngine.java:579)
D/Retrofit(28969):     at libcore.net.http.HttpEngine.readResponse(HttpEngine.java:827)
D/Retrofit(28969):     at libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:283)
D/Retrofit(28969):     at libcore.net.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:497)
D/Retrofit(28969):     at retrofit.client.UrlConnectionClient.readResponse(UrlConnectionClient.java:73)
D/Retrofit(28969):     at retrofit.client.UrlConnectionClient.execute(UrlConnectionClient.java:38)
D/Retrofit(28969):     at retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:321)
D/Retrofit(28969):     at retrofit.RestAdapter$RestHandler.invoke(RestAdapter.java:240)
D/Retrofit(28969):     at $Proxy3.createUser(Native Method)
D/Retrofit(28969):     at fr.francetv.ludo.backend.services.businessdelegate
    .RetrieveFluxDonneesBDL.postInscription(RetrieveFluxDonneesBDL.java:323)
D/Retrofit(28969):     at fr.francetv.ludo.backend.services.metier.user
    .AdministrerUser.inscriptionUser(AdministrerUser.java:202)
D/Retrofit(28969):     at fr.francetv.ludo.backend.services.metier
    .AdministrerHelper.inscriptionUser(AdministrerHelper.java:158)
D/Retrofit(28969):     at fr.francetv.ludo.ui.inscription
    .InscriptionLoginFragment$3.background(InscriptionLoginFragment.java:136)
D/Retrofit(28969):     at fr.francetv.ludo.ui.inscription
    .InscriptionLoginFragment$3.background(InscriptionLoginFragment.java:1)
D/Retrofit(28969):     at fr.francetv.ludo.backend.services.AsyncHelper.doInBackground(AsyncHelper.java:28)
D/Retrofit(28969):     at fr.francetv.ludo.backend.services.AsyncHelper.doInBackground(AsyncHelper.java:1)
D/Retrofit(28969):     at android.os.AsyncTask$2.call(AsyncTask.java:287)
D/Retrofit(28969):     at java.util.concurrent.FutureTask.run(FutureTask.java:234)
D/Retrofit(28969):     at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
D/Retrofit(28969):     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
D/Retrofit(28969):     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
D/Retrofit(28969):     at java.lang.Thread.run(Thread.java:841)
D/Retrofit(28969): ---- END ERROR

Thanks for your responses

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

This is a known issue:

https://github.com/square/retrofit/issues/397

Did you try using OkHttp?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...