frakbot / FWeather

A weather widget for Android based upon Tobias van Scheider's Authentic Weather design.
https://play.google.com/store/apps/details?id=net.frakbot.FWeather
91 stars 34 forks source link

EOFException while reading the weather #85

Closed rock3r closed 10 years ago

rock3r commented 10 years ago

On a Nexus 4, running stock 4.4:

Unable to retrieve weather
net.frakbot.FWeather.updater.weather.CantGetWeatherException: Error parsing weather feed XML.
    at net.frakbot.FWeather.updater.weather.YahooWeatherApiClient.getWeatherForWoeid(YahooWeatherApiClient.java:162)
    at net.frakbot.FWeather.updater.weather.YahooWeatherApiClient.getWeatherForLocationInfo(YahooWeatherApiClient.java:70)
    at net.frakbot.FWeather.util.WeatherHelper.getWeatherDataForLocation(WeatherHelper.java:273)
    at net.frakbot.FWeather.util.WeatherHelper.getWeather(WeatherHelper.java:119)
    at net.frakbot.FWeather.updater.UpdaterService.onHandleIntent(UpdaterService.java:119)
    at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
    at android.os.Handler.dispatchMessage(Handler.java:102)
    at android.os.Looper.loop(Looper.java:137)
    at android.os.HandlerThread.run(HandlerThread.java:61)
Caused by: java.io.EOFException
    at com.android.okhttp.internal.Util.readAsciiLine(Util.java:318)
    at com.android.okhttp.internal.http.RawHeaders.fromBytes(RawHeaders.java:308)
    at com.android.okhttp.internal.http.HttpTransport.readResponseHeaders(HttpTransport.java:135)
    at com.android.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:644)
    at com.android.okhttp.internal.http.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:347)
    at com.android.okhttp.internal.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:296)
    at com.android.okhttp.internal.http.HttpURLConnectionImpl.getInputStream(HttpURLConnectionImpl.java:179)
    at net.frakbot.FWeather.updater.weather.YahooWeatherApiClient.getWeatherForWoeid(YahooWeatherApiClient.java:88)
    ... 8 more

It looks like it's an OkHttp issue. Also, I didn't know that OkHttp had replaced the old Http Client since Android 4.2, but it's indeed in the [https://android.googlesource.com/platform/external/okhttp/+refs](Android source code).

It could be related to this issue: https://github.com/square/okhttp/issues/220 (or not). Could be solved by avoiding reliance on the system's HttpUrlConnection, which might be using an older OkHttp version. In the meantime it could be worked around by catching the exception.

rock3r commented 10 years ago

CC @frapontillo who reported this