8272616: Strange code in java.text.DecimalFormat#applyPattern

Reviewed-by: bpb, naoto, iris
This commit is contained in:
Andrey Turbanov 2021-08-19 15:57:18 +00:00 committed by Brian Burkhalter
parent 03b5e99d99
commit 51c1b9a687

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -3406,16 +3406,14 @@ public class DecimalFormat extends NumberFormat {
// opening quote or two quotes, which is a quote
// literal. That is, we have the first quote in 'do'
// or o''clock.
if (ch == QUOTE) {
if ((pos+1) < pattern.length() &&
pattern.charAt(pos+1) == QUOTE) {
++pos;
affix.append("''"); // o''clock
} else {
inQuote = true; // 'do'
}
continue;
if ((pos+1) < pattern.length() &&
pattern.charAt(pos+1) == QUOTE) {
++pos;
affix.append("''"); // o''clock
} else {
inQuote = true; // 'do'
}
continue;
} else if (ch == separator) {
// Don't allow separators before we see digit
// characters of phase 1, and don't allow separators