Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6871307

RTL Languages not supporting negative numbers in NumberFormat

    XMLWordPrintable

Details

    Description

      FULL PRODUCT VERSION :
      java version "1.6.0_14"
      Java(TM) SE Runtime Environment (build 1.6.0_14-b08)
      Java HotSpot(TM) Server VM (build 14.0-b16, mixed mode)


      ADDITIONAL OS VERSION INFORMATION :
      SunOS 5.11 snv_117 i86pc i386 i86pc

      A DESCRIPTION OF THE PROBLEM :
      When formating a negative number using java.text.NumberFormat for a RTL language, the number returned is invalid. i.e. -1 returns "1-" when it should still return "-1".

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Create a Number Format object using a RTL language locale, such as ar_AE.
      Try to format a negative number.
      The string returned is incorrect.


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.text.NumberFormat;
      import java.util.Locale;

      public class NumberFormatTest {

          public static void main(String[] args) {
              Locale locale = new Locale("ar", "AE");
              NumberFormat format = NumberFormat.getNumberInstance(locale);

              String f = format.format(-1);
              System.out.println("Format: " + f);
          }
      }

      ---------- END SOURCE ----------

      Attachments

        Activity

          People

            yhuang Yong Huang (Inactive)
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: