2

I'm getting this error when using Retrofit 2.0 at the onFailure method. I'm trying to communicate with a REST webservice and can't receive the json formatted response. I already verified that the json response is valid in different json validators online and adjusted the webconfig of the service to handle an appropriate request/response size and I'm also getting nothing using the Advanced Rest Client from Firefox (no response and no timeout). These are some details from the Throwable object in Android Studio:

cause = {EOFException@831563081000} "java.io.EOFException: \n not found: size=0 content=..." suppressedExceptions = {Collections$EmptyList@831559789744} size = 0

I think this is telling it is related with some invalid character in the json object, but, again, the validation on my json should be fine.

Any help may help.

YeinCM-Qva
  • 141
  • 2
  • 15

1 Answers1

0

This Exception was caused by improper JSON serialization from my web service. It happens with datetime datatypes very frequently. So when the parsers tries to deserialize the JSON string it reaches the unexpected end of file caused by some invalid character or similar issue.

PD: This could be similar problem found by other android developers consuming web services but probably in a different manner.

YeinCM-Qva
  • 141
  • 2
  • 15
  • I ran into the same issue myself under similar circumstances. If you don't mind, could you share with us what your solution to the problem was? I suspect it might be an encoding mismatch, where Android usually expects UTF-8 and Microsoft conventions usually lean towards ANSI or some proprietary encoding. For reference, [see this](https://stackoverflow.com/questions/700187/unicode-utf-ascii-ansi-format-differences). If I have success on my own, I'll post my solution to help others out as well. – Conner Harkness Oct 27 '17 at 15:10
  • @ConnerHarkness you are in the right path. This type of issues are mainly caused by serialization of complex objects as such as Dates in .net, this happened to me some time ago but I remember the some specific character in the conversion to JSON was causing the issue – YeinCM-Qva Oct 30 '17 at 16:00