diff options
| author | Daisuke Miyakawa <dmiyakawa@google.com> | 2009-05-19 07:35:09 +0900 |
|---|---|---|
| committer | Daisuke Miyakawa <dmiyakawa@google.com> | 2009-05-19 08:26:32 +0900 |
| commit | 841ddefcb5720bcc1925f373b66224411f99a9fa (patch) | |
| tree | 14bc10b8941fc32f28335ef87616359cce01fcba /core/java/android/util | |
| parent | 6342d3936ad8c9e6cf5bba1fc88c4e9338391bb4 (diff) | |
| download | frameworks_base-841ddefcb5720bcc1925f373b66224411f99a9fa.zip frameworks_base-841ddefcb5720bcc1925f373b66224411f99a9fa.tar.gz frameworks_base-841ddefcb5720bcc1925f373b66224411f99a9fa.tar.bz2 | |
Hand merge from cupcake_dcm to donut, part 2.
Modify Contacts-related java files and update vCard importer code to the latest.
Diffstat (limited to 'core/java/android/util')
| -rw-r--r-- | core/java/android/util/CharsetUtils.java | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/core/java/android/util/CharsetUtils.java b/core/java/android/util/CharsetUtils.java index 7553029..9d91aca 100644 --- a/core/java/android/util/CharsetUtils.java +++ b/core/java/android/util/CharsetUtils.java @@ -142,20 +142,25 @@ public final class CharsetUtils { /** * Returns whether the given character set name indicates the Shift-JIS - * encoding. + * encoding. Returns false if the name is null. * * @param charsetName the character set name * @return {@code true} if the name corresponds to Shift-JIS or * {@code false} if not */ private static boolean isShiftJis(String charsetName) { - if (charsetName.length() != 9) { - // Bail quickly if the length doesn't match. + // Bail quickly if the length doesn't match. + if (charsetName == null) { + return false; + } + int length = charsetName.length(); + if (length != 4 && length != 9) { return false; } return charsetName.equalsIgnoreCase("shift_jis") - || charsetName.equalsIgnoreCase("shift-jis"); + || charsetName.equalsIgnoreCase("shift-jis") + || charsetName.equalsIgnoreCase("sjis"); } /** |
