zh-wang / YWeatherGetter4a

An Yahoo Weather API wrapper for android
99 stars 45 forks source link

Random bug with LatLon query #15

Closed gollumiko closed 10 years ago

gollumiko commented 10 years ago

Usually it works well, but sometimes it seems that "parseWeatherInfo" returns a null value.

This is the stack trace:

java.lang.RuntimeException: An error occured while executing doInBackground()
at android.os.AsyncTask$3.done(AsyncTask.java:299)
at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352)
at java.util.concurrent.FutureTask.setException(FutureTask.java:219)
at java.util.concurrent.FutureTask.run(FutureTask.java:239)
at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
at java.lang.Thread.run(Thread.java:841)
Caused by: java.lang.NullPointerException
at zh.wang.android.apis.yweathergetter4a.YahooWeather$WeatherQueryByLatLonTask.doInBackground(YahooWeather.java:441)
at zh.wang.android.apis.yweathergetter4a.YahooWeather$WeatherQueryByLatLonTask.doInBackground(YahooWeather.java:1)
at android.os.AsyncTask$2.call(AsyncTask.java:287)
at java.util.concurrent.FutureTask.run(FutureTask.java:234)
... 4 more
zh-wang commented 10 years ago

Thank you for your feedback. Exactly, using a null value returned from "parseWeatherInfo" causes this problem. I have fix it by arranging the parse process, and it can correctly handle a NPE now.