Bug 834471 - Part 1: Fix some FindBugs warnings about strings. r=jchen
authorChris Peterson <cpeterson@mozilla.com>
Fri, 25 Jan 2013 16:32:04 -0800
changeset 120106 e67cde12f97628aaad1abb4bc47b3e8c4fdeea6c
parent 120105 ed3fc621728b77548d710aa166f10e111807ad0a
child 120107 23e83bcb87f8490cbe4f5294cee8ff2d4db330f7
push id22040
push usercpeterson@mozilla.com
push dateMon, 28 Jan 2013 22:40:41 +0000
treeherdermozilla-inbound@185ab4996e2d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjchen
bugs834471
milestone21.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 834471 - Part 1: Fix some FindBugs warnings about strings. r=jchen
mobile/android/base/GeckoInputConnection.java
mobile/android/base/InputMethods.java
--- a/mobile/android/base/GeckoInputConnection.java
+++ b/mobile/android/base/GeckoInputConnection.java
@@ -41,17 +41,17 @@ class GeckoInputConnection
     private static final int INLINE_IME_MIN_DISPLAY_SIZE = 480;
 
     // Managed only by notifyIMEEnabled; see comments in notifyIMEEnabled
     private int mIMEState;
     private String mIMETypeHint = "";
     private String mIMEModeHint = "";
     private String mIMEActionHint = "";
 
-    private String mCurrentInputMethod;
+    private String mCurrentInputMethod = "";
 
     private final GeckoEditableClient mEditableClient;
     protected int mBatchEditCount;
     private ExtractedTextRequest mUpdateRequest;
     private final ExtractedText mUpdateExtract = new ExtractedText();
     private boolean mBatchSelectionChanged;
     private boolean mBatchTextChanged;
     private long mLastRestartInputTime;
@@ -380,17 +380,17 @@ class GeckoInputConnection
 
         String prevInputMethod = mCurrentInputMethod;
         mCurrentInputMethod = InputMethods.getCurrentInputMethod(app);
         if (DEBUG) {
             Log.d(LOGTAG, "IME: CurrentInputMethod=" + mCurrentInputMethod);
         }
 
         // If the user has changed IMEs, then notify input method observers.
-        if (mCurrentInputMethod != prevInputMethod) {
+        if (!mCurrentInputMethod.equals(prevInputMethod)) {
             FormAssistPopup popup = app.mFormAssistPopup;
             if (popup != null) {
                 popup.onInputMethodChanged(mCurrentInputMethod);
             }
         }
 
         if (mIMEState == IME_STATE_PLUGIN) {
             // Since we are using a temporary string as the editable, the selection is at 0
@@ -651,9 +651,8 @@ final class DebugGeckoInputConnection
         } else {
             debugAppend(log.append(") = "), ret);
         }
         Log.d(LOGTAG, log.toString());
 
         return ret;
     }
 }
-
--- a/mobile/android/base/InputMethods.java
+++ b/mobile/android/base/InputMethods.java
@@ -46,17 +46,18 @@ final class InputMethods {
                                                             METHOD_OPENWNN_PLUS,
                                                             METHOD_SIMEJI,
                                                             });
     private static Boolean sIsPreJellyBeanAsusTransformer;
 
     private InputMethods() {}
 
     public static String getCurrentInputMethod(Context context) {
-        return Secure.getString(context.getContentResolver(), Secure.DEFAULT_INPUT_METHOD);
+        String inputMethod = Secure.getString(context.getContentResolver(), Secure.DEFAULT_INPUT_METHOD);
+        return (inputMethod != null ? inputMethod : "");
     }
 
     public static InputMethodInfo getInputMethodInfo(Context context, String inputMethod) {
         InputMethodManager imm = getInputMethodManager(context);
         Collection<InputMethodInfo> infos = imm.getEnabledInputMethodList();
         for (InputMethodInfo info : infos) {
             if (info.getId().equals(inputMethod)) {
                 return info;