Re: [PATCH] Fix handling of negative suffix in DecimalFormat

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello. Any feedback?

Guillermo

2015-01-30 14:28 GMT+01:00 Guillermo Rodriguez <guille.rodriguez@xxxxxxxxx>:
> 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
guille.rodriguez@xxxxxxxxx




[Index of Archives]     [Linux Kernel]     [Linux Cryptography]     [Fedora]     [Fedora Directory]     [Red Hat Development]

  Powered by Linux