diff options
author | Tor Norbye <tnorbye@google.com> | 2012-01-06 09:29:25 -0800 |
---|---|---|
committer | Tor Norbye <tnorbye@google.com> | 2012-01-06 09:29:25 -0800 |
commit | 18bce12c5916331971b2e8108f8485cc56b696d3 (patch) | |
tree | 2c634dc2e09bf68bfe21faa0674c208e62017c71 /sdkmanager | |
parent | 9f338c0725644f84597366c1e4acb680a72b3f00 (diff) | |
download | sdk-18bce12c5916331971b2e8108f8485cc56b696d3.zip sdk-18bce12c5916331971b2e8108f8485cc56b696d3.tar.gz sdk-18bce12c5916331971b2e8108f8485cc56b696d3.tar.bz2 |
Fix locale handling of uppercase/lowercase
This changeset fixes issue
23747: i and İ character problem in turkish operating Systems...
and probably many other bugs in the Turkish locale.
Basically, we had a lot of String.toLowerCase() and
String.toUpperCase() calls. This performs locale sensitive
conversions, which in many cases is NOT what we want; for "machine
readable" conversions we should be using Locale.US which performs no
special cases.
For more, see
http://developer.android.com/reference/java/util/Locale.html#default_locale
Change-Id: I996b0e70fb377e8dae484c5811deb8bc9afb684c
Diffstat (limited to 'sdkmanager')
6 files changed, 13 insertions, 7 deletions
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/SystemImage.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/SystemImage.java index 422ae90..c4957e0 100755 --- a/sdkmanager/libs/sdklib/src/com/android/sdklib/SystemImage.java +++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/SystemImage.java @@ -19,6 +19,7 @@ package com.android.sdklib; import com.android.sdklib.io.FileOp; import java.io.File; +import java.util.Locale; /** @@ -158,7 +159,7 @@ public class SystemImage implements ISystemImage { public String toString() { return String.format("SystemImage ABI=%s, location %s='%s'", //$NON-NLS-1$ mAbiType, - mLocationtype.toString().replace('_', ' ').toLowerCase(), + mLocationtype.toString().replace('_', ' ').toLowerCase(Locale.US), mLocation ); } diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/AddonPackage.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/AddonPackage.java index 09bf3c9..6ce1118 100755 --- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/AddonPackage.java +++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/AddonPackage.java @@ -34,6 +34,7 @@ import org.w3c.dom.Node; import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Locale;
import java.util.Map;
import java.util.Properties;
@@ -421,7 +422,7 @@ public class AddonPackage extends Package private String encodeAddonName() {
String name = String.format("addon-%s-%s-%s", //$NON-NLS-1$
getName(), getVendor(), mVersion.getApiString());
- name = name.toLowerCase();
+ name = name.toLowerCase(Locale.US);
name = name.replaceAll("[^a-z0-9_-]+", "_"); //$NON-NLS-1$ //$NON-NLS-2$
name = name.replaceAll("_+", "_"); //$NON-NLS-1$ //$NON-NLS-2$
return name;
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/Archive.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/Archive.java index 52d9221..4fa7c38 100755 --- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/Archive.java +++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/Archive.java @@ -23,6 +23,7 @@ import com.android.sdklib.io.FileOp; import java.io.File;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
+import java.util.Locale;
import java.util.Properties;
@@ -88,7 +89,7 @@ public class Archive implements IDescription, Comparable<Archive> { /** Returns the XML name of the OS. */
public String getXmlName() {
- return toString().toLowerCase();
+ return toString().toLowerCase(Locale.US);
}
/**
@@ -140,7 +141,7 @@ public class Archive implements IDescription, Comparable<Archive> { /** Returns the XML name of the architecture. */
public String getXmlName() {
- return toString().toLowerCase();
+ return toString().toLowerCase(Locale.US);
}
/**
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/SystemImagePackage.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/SystemImagePackage.java index 5457a35..268a24c 100755 --- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/SystemImagePackage.java +++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/SystemImagePackage.java @@ -31,6 +31,7 @@ import com.android.sdklib.repository.SdkRepoConstants; import org.w3c.dom.Node;
import java.io.File;
+import java.util.Locale;
import java.util.Map;
import java.util.Properties;
@@ -294,7 +295,7 @@ public class SystemImagePackage extends Package // Computes a folder directory using the sanitized abi string.
String abi = mAbi;
- abi = abi.toLowerCase();
+ abi = abi.toLowerCase(Locale.US);
abi = abi.replaceAll("[^a-z0-9_-]+", "_"); //$NON-NLS-1$ //$NON-NLS-2$
abi = abi.replaceAll("_+", "_"); //$NON-NLS-1$ //$NON-NLS-2$
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/xml/AndroidManifestParser.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/xml/AndroidManifestParser.java index 9590dc3..1c10828 100644 --- a/sdkmanager/libs/sdklib/src/com/android/sdklib/xml/AndroidManifestParser.java +++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/xml/AndroidManifestParser.java @@ -41,6 +41,7 @@ import org.xml.sax.helpers.DefaultHandler; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; +import java.util.Locale; import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.SAXParser; @@ -393,7 +394,7 @@ public class AndroidManifestParser { String exportedStr = getAttributeValue(attributes, AndroidManifest.ATTRIBUTE_EXPORTED, true); boolean exported = exportedStr == null || - exportedStr.toLowerCase().equals("true"); //$NON-NLS-1$ + exportedStr.toLowerCase(Locale.US).equals("true"); //$NON-NLS-1$ mCurrentActivity = new Activity(activityName, exported); mManifestData.mActivities.add(mCurrentActivity); diff --git a/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/icons/ImageFactory.java b/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/icons/ImageFactory.java index 03b5a5b..fa2e360 100755 --- a/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/icons/ImageFactory.java +++ b/sdkmanager/libs/sdkuilib/src/com/android/sdkuilib/internal/repository/icons/ImageFactory.java @@ -28,6 +28,7 @@ import org.eclipse.swt.widgets.Display; import java.io.InputStream;
import java.util.HashMap;
import java.util.Iterator;
+import java.util.Locale;
import java.util.Map;
@@ -101,7 +102,7 @@ public class ImageFactory { if (clz.endsWith(Package.class.getSimpleName())) {
String name = clz.replaceFirst(Package.class.getSimpleName(), "") //$NON-NLS-1$
.replace("SystemImage", "sysimg") //$NON-NLS-1$ //$NON-NLS-2$
- .toLowerCase();
+ .toLowerCase(Locale.US);
name += "_pkg_16.png"; //$NON-NLS-1$
return getImageByName(name);
}
|