-
Bug
-
Resolution: Fixed
-
P4
-
17, 21, 23, 24
-
b01
-
generic
-
generic
-
Verified
See the following snippet, which demonstrates unexpected behavior
var fmt = NumberFormat.getCompactNumberInstance(Locale.US, NumberFormat.Style.SHORT)
fmt.parse("5") // returns 5
fmt.parse("5K") // returns 5000
fmt.setParseIntegerOnly(true)
fmt.parse("5K") // returns 5000
fmt.parse("5") // unexpectedly throws StringIndexOutOfBoundsException
The position in parse needs to be checked before invoking charAt.
var fmt = NumberFormat.getCompactNumberInstance(Locale.US, NumberFormat.Style.SHORT)
fmt.parse("5") // returns 5
fmt.parse("5K") // returns 5000
fmt.setParseIntegerOnly(true)
fmt.parse("5K") // returns 5000
fmt.parse("5") // unexpectedly throws StringIndexOutOfBoundsException
The position in parse needs to be checked before invoking charAt.