survivingwithandroid / WeatherLib

Android Weather Library: android weather lib to develop weather based app fast and easily
http://survivingwithandroid.github.io/WeatherLib/
640 stars 170 forks source link

getCurrentCondition JSONException: No value for deg #32

Closed ClementHard closed 9 years ago

ClementHard commented 9 years ago

I get the following error while using getCurrentCondition with OpenWeatherMap :

org.json.JSONException: No value for deg
 at org.json.JSONObject.get(JSONObject.java:389)
 at org.json.JSONObject.getDouble(JSONObject.java:444)
 at com.survivingwithandroid.weather.lib.provider.openweathermap.OpenweathermapProvider.getFloat(OpenweathermapProvider.java:514)
 at com.survivingwithandroid.weather.lib.provider.openweathermap.OpenweathermapProvider.getCurrentCondition(OpenweathermapProvider.java:135)
 at com.survivingwithandroid.weather.lib.client.okhttp.WeatherDefaultClient$4.onResponse(WeatherDefaultClient.java:380)
 at com.squareup.okhttp.Call$AsyncCall.execute(Call.java:162)
 at com.squareup.okhttp.internal.NamedRunnable.run(NamedRunnable.java:33)
 at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
 at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
 at java.lang.Thread.run(Thread.java:818)
levj220 commented 9 years ago

I get the following error as well, starting recently. This only shows up using the OpenWeatherMap Provider:

org.json.JSONException: No value for humidity
at org.json.JSONObject.get(JSONObject.java:389)
at org.json.JSONObject.getInt(JSONObject.java:478)
at com.survivingwithandroid.weather.lib.provider.openweathermap.OpenweathermapProvider.getInt(OpenweathermapProvider.java:518)
at com.survivingwithandroid.weather.lib.provider.openweathermap.OpenweathermapProvider.getCurrentCondition(OpenweathermapProvider.java:124)
at com.survivingwithandroid.weather.lib.client.okhttp.WeatherDefaultClient$4.onResponse(WeatherDefaultClient.java:380)
at com.squareup.okhttp.Call$AsyncCall.execute(Call.java:162)
at com.squareup.okhttp.internal.NamedRunnable.run(NamedRunnable.java:33)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:818)
ClementHard commented 9 years ago

As suggested by @HugoGressen in #28, maybe you should use a JSON library like GSON or Jackson to parse the results. Also, is there an openweathermap change log ?

survivingwithandroid commented 9 years ago

The problem i'm facing with OWM is i can't find a doc describing if a tag is mandatory or not. Anyway i will make these tags optional. Thx for you support!

athkalia commented 9 years ago

I can confirm that this is causing my application to crash as well

athkalia commented 9 years ago

Any plans on when going to release this fix with optional tags ?

swapps commented 9 years ago

hi, i'm having the same issue, any coming fix ?

survivingwithandroid commented 9 years ago

In the master branch there is already a fix but you have to recompile the source. I'm planning to release a new version as beta in this week. Thx for your support!

swapps commented 9 years ago

Please let use know when it’s ready.

De : Surviving with android (by Francesco Azzola) [mailto:notifications@github.com] Envoyé : mercredi 14 octobre 2015 15:23 À : survivingwithandroid/WeatherLib Cc : swapps Objet : Re: [WeatherLib] getCurrentCondition JSONException: No value for deg (#32)

In the master branch there is already a fix but you have to recompile the source. I'm planning to release a new version as beta in this week. Thx for your support!

— Reply to this email directly or view it on GitHub https://github.com/survivingwithandroid/WeatherLib/issues/32#issuecomment-148047779 . https://github.com/notifications/beacon/AHqKb4MSPj0-jy5aWNFpAPpe2H1d1upnks5o7k6tgaJpZM4GAgvC.gif

survivingwithandroid commented 9 years ago

The problem should b solved in 1.5.9 just released