Bug 1312114 - Post: make catch more specific to not hide exceptions r=sebastian
Catching everything is annoying, since we want to be able to see non-JSON related
exceptions that happen during icon loading. Specifically: it was harder to debug
issues during the VectorDrawable support upgrade.
MozReview-Commit-ID: 79j7FRxu2hh
--- a/mobile/android/base/java/org/mozilla/gecko/prompts/PromptListItem.java
+++ b/mobile/android/base/java/org/mozilla/gecko/prompts/PromptListItem.java
@@ -1,10 +1,11 @@
package org.mozilla.gecko.prompts;
+import org.json.JSONException;
import org.mozilla.gecko.IntentHelper;
import org.mozilla.gecko.GeckoAppShell;
import org.mozilla.gecko.ThumbnailHelper;
import org.mozilla.gecko.util.ResourceDrawableUtils;
import org.mozilla.gecko.widget.GeckoActionProvider;
import org.json.JSONArray;
import org.json.JSONObject;
@@ -114,14 +115,14 @@ public class PromptListItem {
}
int length = items.length();
List<PromptListItem> list = new ArrayList<>(length);
for (int i = 0; i < length; i++) {
try {
PromptListItem item = new PromptListItem(items.getJSONObject(i));
list.add(item);
- } catch (Exception ex) { }
+ } catch (JSONException ex) { }
}
return list.toArray(new PromptListItem[length]);
}
}