-
Bug
-
Resolution: Duplicate
-
P3
-
None
-
11
ADDITIONAL SYSTEM INFORMATION :
Java SE 11
A DESCRIPTION OF THE PROBLEM :
The currency format for US locale in Java 8 for negative numbers included the parenthesis, but in Java 11 the negative numbers do not have parenthesis anymore.
Example: -$195.00 is displayed as ($195.00) in Java 8 where it is displayed as -195.00 in Java 11
REGRESSION : Last worked in version 8u201
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
See attached sample program that was used to test on Java 8 vs. Java 11
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
-$195.00 is displayed as ($195.00) in Java 8 where it is displayed as -195.00 in Java 11
ACTUAL -
-$195.00 is displayed as ($195.00) in Java 8 where it is displayed as -195.00 in Java 11
---------- BEGIN SOURCE ----------
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.Locale;
public class NumFormat {
public static void main(String[] args) {
BigDecimal num = new BigDecimal(-10.00);
NumberFormat nf = NumberFormat.getCurrencyInstance(Locale.US);
DecimalFormat df = (DecimalFormat) DecimalFormat.getCurrencyInstance(Locale.US);
System.out.println("the prefix is : " + df.getNegativePrefix());
System.out.println("the numberformatted value : " + nf.format(num));
System.out.println("the decimal formatted value " + df.format(num));
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
No workaround
FREQUENCY : always
Java SE 11
A DESCRIPTION OF THE PROBLEM :
The currency format for US locale in Java 8 for negative numbers included the parenthesis, but in Java 11 the negative numbers do not have parenthesis anymore.
Example: -$195.00 is displayed as ($195.00) in Java 8 where it is displayed as -195.00 in Java 11
REGRESSION : Last worked in version 8u201
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
See attached sample program that was used to test on Java 8 vs. Java 11
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
-$195.00 is displayed as ($195.00) in Java 8 where it is displayed as -195.00 in Java 11
ACTUAL -
-$195.00 is displayed as ($195.00) in Java 8 where it is displayed as -195.00 in Java 11
---------- BEGIN SOURCE ----------
import java.math.BigDecimal;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.Locale;
public class NumFormat {
public static void main(String[] args) {
BigDecimal num = new BigDecimal(-10.00);
NumberFormat nf = NumberFormat.getCurrencyInstance(Locale.US);
DecimalFormat df = (DecimalFormat) DecimalFormat.getCurrencyInstance(Locale.US);
System.out.println("the prefix is : " + df.getNegativePrefix());
System.out.println("the numberformatted value : " + nf.format(num));
System.out.println("the decimal formatted value " + df.format(num));
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
No workaround
FREQUENCY : always
- duplicates
-
JDK-8215181 Accounting currency format support
- Resolved