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 232903 75f9efa43bb4390881c54dea2188f13408e5d64e
parent 232902 3e9de16c4c17411649cb5aa617ee64d1f66d5e38
child 232904 4b9e08526336f83f305cbdc85e93da7ce8401dfa
push id4187
push userbhearsum@mozilla.com
push dateFri, 28 Nov 2014 15:29:12 +0000
treeherdermozilla-beta@f23cc6a30c11 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs1079876
milestone35.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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;
         }
     }
 }