Bug 1170886 - Specify correct Locale in String.toUpperCase and remove @SuppressLint. r=rnewman
authorMichael Comella <michael.l.comella@gmail.com>
Thu, 04 Jun 2015 17:38:51 -0700
changeset 247267 51066bde3d7ad0c2d37031899ed5af5a6780c112
parent 247266 c42a875da455354741e448646c058b75de8bc69d
child 247268 1d2ae3445821acbce06c961882696b28b374bd50
push id28859
push usercbook@mozilla.com
push dateFri, 05 Jun 2015 13:08:54 +0000
treeherdermozilla-central@2bd39dd8c536 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrnewman
bugs1170886
milestone41.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 1170886 - Specify correct Locale in String.toUpperCase and remove @SuppressLint. r=rnewman
mobile/android/base/sync/Utils.java
--- a/mobile/android/base/sync/Utils.java
+++ b/mobile/android/base/sync/Utils.java
@@ -26,17 +26,16 @@ import java.util.TreeMap;
 
 import org.json.simple.JSONArray;
 import org.mozilla.apache.commons.codec.binary.Base32;
 import org.mozilla.apache.commons.codec.binary.Base64;
 import org.mozilla.gecko.background.common.log.Logger;
 import org.mozilla.gecko.background.nativecode.NativeCrypto;
 import org.mozilla.gecko.sync.setup.Constants;
 
-import android.annotation.SuppressLint;
 import android.content.Context;
 import android.content.SharedPreferences;
 import android.os.Bundle;
 import android.text.Spannable;
 import android.text.Spanned;
 import android.text.style.ClickableSpan;
 
 public class Utils {
@@ -139,21 +138,20 @@ public class Utils {
    *        A byte array of decoded values.
    * @throws UnsupportedEncodingException
    *         Should not occur.
    */
   public static byte[] decodeBase64(String base64) throws UnsupportedEncodingException {
     return Base64.decodeBase64(base64.getBytes("UTF-8"));
   }
 
-  @SuppressLint("DefaultLocale")
   public static byte[] decodeFriendlyBase32(String base32) {
     Base32 converter = new Base32();
     final String translated = base32.replace('8', 'l').replace('9', 'o');
-    return converter.decode(translated.toUpperCase());
+    return converter.decode(translated.toUpperCase(Locale.US));
   }
 
   public static byte[] hex2Byte(String str, int byteLength) {
     byte[] second = hex2Byte(str);
     if (second.length >= byteLength) {
       return second;
     }
     // New Java arrays are zeroed: