diff options
author | Deepanshu Gupta <deepanshu@google.com> | 2015-08-26 20:22:29 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-08-26 20:22:29 +0000 |
commit | 5769732e6e945196bb8bc3e10231d63d6c8686b9 (patch) | |
tree | ec21467369e68ce944ce3533fdda47116a25d848 | |
parent | 728fc73130908157770decc593d6e3131e1efd80 (diff) | |
parent | 9d6e87b67eb0d39d7584b12a3e843db68c8c9f3b (diff) | |
download | frameworks_base-5769732e6e945196bb8bc3e10231d63d6c8686b9.zip frameworks_base-5769732e6e945196bb8bc3e10231d63d6c8686b9.tar.gz frameworks_base-5769732e6e945196bb8bc3e10231d63d6c8686b9.tar.bz2 |
am 9d6e87b6: am da687918: Make getInt in BridgeTypedArray accept empty String. [DO NOT MERGE]
* commit '9d6e87b67eb0d39d7584b12a3e843db68c8c9f3b':
Make getInt in BridgeTypedArray accept empty String. [DO NOT MERGE]
-rw-r--r-- | tools/layoutlib/bridge/src/android/content/res/BridgeTypedArray.java | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/tools/layoutlib/bridge/src/android/content/res/BridgeTypedArray.java b/tools/layoutlib/bridge/src/android/content/res/BridgeTypedArray.java index d54e3d7..b8fd1ca 100644 --- a/tools/layoutlib/bridge/src/android/content/res/BridgeTypedArray.java +++ b/tools/layoutlib/bridge/src/android/content/res/BridgeTypedArray.java @@ -239,15 +239,12 @@ public final class BridgeTypedArray extends TypedArray { public int getInt(int index, int defValue) { String s = getString(index); try { - if (s != null) { - return convertValueToInt(s, defValue); - } + return convertValueToInt(s, defValue); } catch (NumberFormatException e) { Bridge.getLog().warning(LayoutLog.TAG_RESOURCES_FORMAT, String.format("\"%1$s\" in attribute \"%2$s\" is not a valid integer", s, mNames[index]), null); - return defValue; } return defValue; } @@ -948,7 +945,7 @@ public final class BridgeTypedArray extends TypedArray { * "XXXXXXXX" > 80000000. */ private static int convertValueToInt(@Nullable String charSeq, int defValue) { - if (null == charSeq) + if (null == charSeq || charSeq.isEmpty()) return defValue; int sign = 1; |