Fix No updates found for users with Turkish Locale

There is a problem with Java's toLowerCase() method which returns
"LATIN SMALL LETTER DOTLESS I" for "I" character. This breaks update check
because Utils.getInstalledBuildType() returns "nıghtly (notice dottles small
i)" instead of "nightly".

This change forces toLowerCase() to use ROOT locale which is recommended in
javadocs

There is a note for Turkish locale on javadocs:
http://devdocs.io/openjdk~8/java/lang/string#toLowerCase--

Change-Id: Ifada815202588d67643136846de08f94cefb46a5
Signed-off-by: Mustafa Karatas <mstfkaratas@gmail.com>
This commit is contained in:
Mustafa Karatas
2017-08-10 13:56:33 +03:00
committed by Luca Stefani
parent 87202371de
commit 2327e83c51
2 changed files with 4 additions and 2 deletions

View File

@@ -31,6 +31,7 @@ import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.UUID;
@@ -153,6 +154,6 @@ public final class LegacySupport {
if (subStrings.length < 4 || subStrings[3].length() < 7) {
throw new IllegalFilenameException("The given filename is not valid");
}
return subStrings[3].toLowerCase();
return subStrings[3].toLowerCase(Locale.ROOT);
}
}

View File

@@ -49,6 +49,7 @@ import java.util.ArrayList;
import java.util.Enumeration;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Set;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
@@ -149,7 +150,7 @@ public class Utils {
}
String incrementalVersion = SystemProperties.get(Constants.PROP_BUILD_VERSION_INCREMENTAL);
String device = SystemProperties.get(Constants.PROP_DEVICE);
String type = SystemProperties.get(Constants.PROP_RELEASE_TYPE).toLowerCase();
String type = SystemProperties.get(Constants.PROP_RELEASE_TYPE).toLowerCase(Locale.ROOT);
return serverUrl + "/v1/" + device + "/" + type + "/" + incrementalVersion;
}