Closed
Description
Hello,
Here in brazil we have phone numbers that start with 0800 and they get treated as ints thereby losing the first 0.
Tracked down the error to this bit of code in XML.java
try {
char initial = string.charAt(0);
boolean negative = false;
if (initial == '-') {
initial = string.charAt(1);
negative = true;
}
if (initial == '0' && string.charAt(negative ? 2 : 1) == '0') {
return string;
}
if ((initial >= '0' && initial <= '9')) {
if (string.indexOf('.') >= 0) {
return Double.valueOf(string);
} else if (string.indexOf('e') < 0 && string.indexOf('E') < 0) {
Long myLong = new Long(string);
if (myLong.longValue() == myLong.intValue()) {
return new Integer(myLong.intValue());
} else {
return myLong;
}
}
}
} catch (Exception ignore) {
}
It seems to want to convert any value 0XNNNN... (where X isn't 0 and N is any digit) as an int.
Any particular reason for this?
Metadata
Metadata
Assignees
Labels
No labels