Bug 1079876 - Handle unexpected exceptions when reading external extras. r=mfinkle, a=sylvestre
authorRichard Newman <rnewman@mozilla.com>
Thu, 09 Oct 2014 08:23:55 -0700
changeset 258702 96bcea5ee703
parent 258701 628f8f6c6f72
child 258703 4c62d5e8d5fc
push id4700
push userryanvm@gmail.com
push date2015-04-21 23:53 +0000
treeherdermozilla-beta@d27c9211ebb3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle, sylvestre
bugs1079876
milestone33.0
Bug 1079876 - Handle unexpected exceptions when reading external extras. r=mfinkle, a=sylvestre
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;
         }
     }
 }