Advanced_Android_Development icon indicating copy to clipboard operation
Advanced_Android_Development copied to clipboard

2.06 - Fixed problem with Json parsing.

Open rsd-raul opened this issue 8 years ago • 0 comments

I run into an issue with the invalid location detection when writting my response and short after with the solution here at 2.06.

The preference location-state never was changing to invalid location because the getInputStream() method throws a FileNotFoudException therefore not giving the method getWeatherDataFromJson the oportunity to retrieve the property cod containing the 404 we were looking for.

The solution is to use getErrorStream to parse the "error" server response and handle the 404 ourselves.

Ps: Also removed some warnings (null checks and similar).

rsd-raul avatar Mar 30 '17 23:03 rsd-raul