Bug 1079876 - Handle unexpected exceptions when reading external extras. r=mfinkle
authorRichard Newman <rnewman@mozilla.com>
Thu, 09 Oct 2014 08:23:55 -0700
changeset 209688 75f9efa43bb4390881c54dea2188f13408e5d64e
parent 209687 3e9de16c4c17411649cb5aa617ee64d1f66d5e38
child 209689 4b9e08526336f83f305cbdc85e93da7ce8401dfa
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersmfinkle
bugs1079876
milestone35.0a1
Bug 1079876 - Handle unexpected exceptions when reading external extras. r=mfinkle
mobile/android/base/util/StringUtils.java
--- a/mobile/android/base/util/StringUtils.java
+++ b/mobile/android/base/util/StringUtils.java
@@ -6,16 +6,17 @@
 package org.mozilla.gecko.util;
 
 import android.content.Intent;
 import android.net.Uri;
 import android.text.TextUtils;
 import android.util.Log;
 
 public class StringUtils {
+    private static final String LOGTAG = "GeckoStringUtils";
 
     private static final String FILTER_URL_PREFIX = "filter://";
     private static final String USER_ENTERED_URL_PREFIX = "user-entered:";
 
     /*
      * This method tries to guess if the given string could be a search query or URL,
      * and returns a previous result if there is ambiguity
      *
@@ -188,13 +189,16 @@ public class StringUtils {
     public static String encodeUserEnteredUrl(String url) {
         return Uri.fromParts("user-entered", url, null).toString();
     }
 
     public static String getStringExtra(Intent intent, String name) {
         try {
             return intent.getStringExtra(name);
         } catch (android.os.BadParcelableException ex) {
-            Log.w("GeckoUtils", "Couldn't get string extra: malformed intent.");
+            Log.w(LOGTAG, "Couldn't get string extra: malformed intent.");
+            return null;
+        } catch (RuntimeException re) {
+            Log.w(LOGTAG, "Couldn't get string extra.", re);
             return null;
         }
     }
 }