Re: [PATCH] Fix handling of negative suffix in DecimalFormat
Guillermo Rodriguez Garcia <[email protected]> Tue, 28 Jul 2015 16:42:06 +0200
| Newsgroups | gmane.comp.java.classpath.devel |
|---|---|
| Message-ID | <CABDcavaKXr8h59stbtaR=OSc29-f0HGeOhZKmq+0jx2__WbeZw@mail.gmail.com> |
Hello. Any feedback? Guillermo 2015-01-30 14:28 GMT+01:00 Guillermo Rodriguez <[email protected]>: > When a negative subpattern is not explicitly defined, > DecimalFormat was not using the positive suffix for > negative values. > > Simple test case to reproduce the problem: > > DecimalFormat tempFormat = new DecimalFormat("0.0 unit"); > System.out.println(tempFormat.format(4.3)); > System.out.println(tempFormat.format(-4.3)); > > Yields: > > 4.3 unit > -4.3 > > --- > java/text/DecimalFormat.java | 1 + > 1 files changed, 1 insertions(+), 0 deletions(-) > > diff --git a/java/text/DecimalFormat.java b/java/text/DecimalFormat.java > index 77af0d3..5e4bf76 100644 > --- a/java/text/DecimalFormat.java > +++ b/java/text/DecimalFormat.java > @@ -1371,6 +1371,7 @@ public class DecimalFormat extends NumberFormat > else > { > this.positiveSuffix = buffer.toString(); > + this.negativeSuffix = positiveSuffix; > } > > return i; > -- > 1.7.0.4 > -- Guillermo Rodriguez Garcia [email protected]