From 2327e83c5144ddb2289d698ec5f9c148acc362a7 Mon Sep 17 00:00:00 2001 From: Mustafa Karatas Date: Thu, 10 Aug 2017 13:56:33 +0300 Subject: [PATCH] Fix No updates found for users with Turkish Locale MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- src/org/lineageos/updater/misc/LegacySupport.java | 3 ++- src/org/lineageos/updater/misc/Utils.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/org/lineageos/updater/misc/LegacySupport.java b/src/org/lineageos/updater/misc/LegacySupport.java index 962aa43a..557a56b3 100644 --- a/src/org/lineageos/updater/misc/LegacySupport.java +++ b/src/org/lineageos/updater/misc/LegacySupport.java @@ -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); } } diff --git a/src/org/lineageos/updater/misc/Utils.java b/src/org/lineageos/updater/misc/Utils.java index 9751da5a..f15be50d 100644 --- a/src/org/lineageos/updater/misc/Utils.java +++ b/src/org/lineageos/updater/misc/Utils.java @@ -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; }