aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Doan <andy.doan@linaro.org>2012-02-08 16:39:34 -0800
committerAndy Doan <andy.doan@linaro.org>2012-02-08 16:39:34 -0800
commit7de6cd37de59c81f38f970763114fa806114aa21 (patch)
tree9f0d1a9458f5a0c3dc11dca57d5ec86b0684d373
parentefe0458e60a4a0d4c902a8a9e2526b3fe3302ece (diff)
downloadLinaroConnect-7de6cd37de59c81f38f970763114fa806114aa21.tar.gz
fix crash reported from market
got a report from the market. this sometimes happens when the json feed downloaded isn't complete like "{" java.lang.ClassCastException: java.lang.String at org.linaro.connect.JSONUtils.toJSON(JSONUtils.java:66) at org.linaro.connect.JSONUtils.getObject(JSONUtils.java:46) at org.linaro.connect.CachedJSONLayoutAdapter.getItems(CachedJSONLayoutAdapter.java:20) at org.linaro.connect.CachedJSONLayoutAdapter.getItems(CachedJSONLayoutAdapter.java:1) at org.linaro.connect.CachedLayoutAdapter$DownloadContentTask.onPostExecute(CachedLayoutAdapter.java:149) at org.linaro.connect.CachedLayoutAdapter$DownloadContentTask.onPostExecute(CachedLayoutAdapter.java:1) at android.os.AsyncTask.finish(AsyncTask.java:417) at android.os.AsyncTask.access$300(AsyncTask.java:127) at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:429) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:150) at android.app.ActivityThread.main(ActivityThread.java:4385) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:507) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:849) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:607) at dalvik.system.NativeStart.main(Native Method)
-rw-r--r--src/org/linaro/connect/JSONUtils.java2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/org/linaro/connect/JSONUtils.java b/src/org/linaro/connect/JSONUtils.java
index 420bdda..b03abeb 100644
--- a/src/org/linaro/connect/JSONUtils.java
+++ b/src/org/linaro/connect/JSONUtils.java
@@ -66,6 +66,8 @@ public class JSONUtils {
return (JSONObject) new JSONTokener(json).nextValue();
} catch(JSONException e) {
Log.e(LinaroConnect.TAG, "Unable to convert string to JSON", e);
+ } catch (ClassCastException e) {
+ Log.e(LinaroConnect.TAG, "Invalid/Incomplete JSON", e);
}
return null;