am da687918: Make getInt in BridgeTypedArray accept empty String. [DO NOT MERGE]

* commit 'da687918e13010d56e3d067e0ef477165cf38e10':
  Make getInt in BridgeTypedArray accept empty String. [DO NOT MERGE]
This commit is contained in:
Deepanshu Gupta
2015-08-26 05:58:21 +00:00
committed by Android Git Automerger

View File

@@ -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;