8333456: CompactNumberFormat integer parsing fails when string has no suffix

Reviewed-by: naoto
This commit is contained in:
Justin Lu 2024-06-06 20:34:46 +00:00
parent 2a37764e74
commit 6238bc8da2
2 changed files with 26 additions and 2 deletions

View file

@ -1736,7 +1736,7 @@ public final class CompactNumberFormat extends NumberFormat {
// If parse integer only is true and the parsing is broken at
// decimal point, then pass/ignore all digits and move pointer
// at the start of suffix, to process the suffix part
if (isParseIntegerOnly()
if (isParseIntegerOnly() && position < text.length()
&& text.charAt(position) == symbols.getDecimalSeparator()) {
position++; // Pass decimal character
for (; position < text.length(); ++position) {