Bug 762068 - Part 3: Replace optString() with null checks. r=mfinkle
authorBrian Nicholson <bnicholson@mozilla.com>
Tue, 12 Jun 2012 10:03:14 -0700
changeset 101291 e04eb0eb59dd27a9fd427319b3d0a37c0e66112f
parent 101290 ec5e7f934d20b8ba1ea51a9578dd369707a5f191
child 101292 dbf0598205cecbb35485f423c88595b1a34918a8
push id1316
push userakeybl@mozilla.com
push dateMon, 27 Aug 2012 22:37:00 +0000
treeherdermozilla-beta@db4b09302ee2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle
bugs762068
milestone16.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 762068 - Part 3: Replace optString() with null checks. r=mfinkle
mobile/android/base/AwesomeBar.java
--- a/mobile/android/base/AwesomeBar.java
+++ b/mobile/android/base/AwesomeBar.java
@@ -229,18 +229,18 @@ public class AwesomeBar extends GeckoAct
 
         GeckoAppShell.registerGeckoEventListener("SearchEngines:Data", this);
         GeckoAppShell.sendEventToGecko(GeckoEvent.createBroadcastEvent("SearchEngines:Get", null));
     }
 
     public void handleMessage(String event, JSONObject message) {
         try {
             if (event.equals("SearchEngines:Data")) {
-                final String suggestEngine = message.optString("suggestEngine");
-                final String suggestTemplate = message.optString("suggestTemplate");
+                final String suggestEngine =  message.isNull("suggestEngine") ? null : message.getString("suggestEngine");
+                final String suggestTemplate = message.isNull("suggestTemplate") ? null : message.getString("suggestTemplate");
                 if (suggestTemplate != null)
                     mSuggestClient = new SuggestClient(GeckoApp.mAppContext, suggestTemplate, SUGGESTION_TIMEOUT, SUGGESTION_MAX);
                 mAwesomeTabs.setSearchEngines(suggestEngine, message.getJSONArray("searchEngines"));
             }
         } catch (Exception e) {
             // do nothing
             Log.i(LOGTAG, "handleMessage throws " + e + " for message: " + event);
         }