android: Use explicit locale when converting settings names
authorTobias Brunner <tobias@strongswan.org>
Wed, 3 Jul 2013 14:30:44 +0000 (16:30 +0200)
committerTobias Brunner <tobias@strongswan.org>
Mon, 8 Jul 2013 16:49:30 +0000 (18:49 +0200)
Apparently, these functions use the user's default locale which might not
yield the expected result (e.g. lowercase I is not i in the Turkish
locale but ı instead).

src/frontends/android/src/org/strongswan/android/logic/imc/collectors/SettingsCollector.java

index 3f6bcff..658c2da 100644 (file)
@@ -17,6 +17,8 @@
 
 package org.strongswan.android.logic.imc.collectors;
 
+import java.util.Locale;
+
 import org.strongswan.android.logic.imc.attributes.Attribute;
 import org.strongswan.android.logic.imc.attributes.SettingsAttribute;
 
@@ -44,10 +46,10 @@ public class SettingsCollector implements Collector
                SettingsAttribute attribute = new SettingsAttribute();
                for (String name : mSettings)
                {
-                       String value = android.provider.Settings.Secure.getString(mContentResolver, name.toLowerCase());
+                       String value = android.provider.Settings.Secure.getString(mContentResolver, name.toLowerCase(Locale.US));
                        if (value == null)
                        {
-                               value = android.provider.Settings.System.getString(mContentResolver, name.toLowerCase());
+                               value = android.provider.Settings.System.getString(mContentResolver, name.toLowerCase(Locale.US));
                        }
                        if (value != null)
                        {