Bug 1312114 - Post: make catch more specific to not hide exceptions r=sebastian draft
authorAndrzej Hunt <ahunt@mozilla.com>
Fri, 21 Oct 2016 14:55:09 -0700
changeset 433297 4bb14434fce255fea585072e83e3d3723a72611b
parent 433296 1ef542376460e0f532145d7eed668db1c879e449
child 433298 51b51e42e6aee2c8afe668c0f001693e920fbfb8
push id34532
push userahunt@mozilla.com
push dateThu, 03 Nov 2016 10:57:55 +0000
reviewerssebastian
bugs1312114
milestone52.0a1
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
mobile/android/base/java/org/mozilla/gecko/prompts/PromptListItem.java
--- 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]);
     }
 }