-
Enhancement
-
Resolution: Fixed
-
P4
-
1.4.2, 5.0, 6u22
-
b03
-
x86
-
windows_xp
-
Not verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2152120 | OpenJDK6 | Joe Darcy | P3 | Resolved | Fixed | b01 |
Name: gm110360 Date: 03/22/2004
A DESCRIPTION OF THE REQUEST :
Integer.parseInt("+12") throws a NumberFormatException while
Integer.parseInt("-12") return a correct value.
JUSTIFICATION :
Please allow the parsing of explicit signed positive integer for getting coherence and better lisibility in the processing of int, otherwise one has to write
if (stringNumber.charAt(0) == '+') {
Integer.parseInt(stringNumber.substring(1));
} else {
Integer.parseInt(stringNumber);
}
This enhancement applies also to Byte, Short and Long
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Integer.parseInt should return the right value for an explicitly positive signed integer.
ACTUAL -
throws NumberFormatException
(Incident Review ID: 244493)
======================================================================
###@###.### 10/28/04 00:53 GMT
A DESCRIPTION OF THE REQUEST :
Integer.parseInt("+12") throws a NumberFormatException while
Integer.parseInt("-12") return a correct value.
JUSTIFICATION :
Please allow the parsing of explicit signed positive integer for getting coherence and better lisibility in the processing of int, otherwise one has to write
if (stringNumber.charAt(0) == '+') {
Integer.parseInt(stringNumber.substring(1));
} else {
Integer.parseInt(stringNumber);
}
This enhancement applies also to Byte, Short and Long
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Integer.parseInt should return the right value for an explicitly positive signed integer.
ACTUAL -
throws NumberFormatException
(Incident Review ID: 244493)
======================================================================
###@###.### 10/28/04 00:53 GMT
- backported by
-
JDK-2152120 Allow signed positive integer to be parsed instead of a NumerFormatException
-
- Resolved
-
- duplicates
-
JDK-6999904 int a = Integer.parseInt(args[0]) does not accept strings with "+" such as "+5"
-
- Closed
-
-
JDK-6233144 Both Integer.decode and Integer.parseInt fail when intger string starts with a +
-
- Closed
-
- relates to
-
JDK-6576055 Integer.parseInt(String) should not accept just '+'
-
- Closed
-
-
JDK-8249273 Documentation of BigInteger(String) constructor does not mention leading plus
-
- Closed
-