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

NumberFormat can't parse negative numbers for FI locale

XMLWordPrintable

      FULL PRODUCT VERSION :
      java version "9"
      Java(TM) SE Runtime Environment (build 9+181)
      Java HotSpot(TM) 64-Bit Server VM (build 9+181, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      OS X 10.12.6

      A DESCRIPTION OF THE PROBLEM :
       java.text.NumberFormat.getInstance(new Locale("fi", "FI")).parse("1,5") => 1.5 (correct)

       java.text.NumberFormat.getInstance(new Locale("fi", "FI")).parse("-1,5") => java.text.ParseException thrown: Unparseable number: "-1,5" (at NumberFormat.parse (NumberFormat.java:393))

      The latter should produce -1.5

      REGRESSION. Last worked in version 8u144

      ADDITIONAL REGRESSION INFORMATION:
      java version "9"
      Java(TM) SE Runtime Environment (build 9+181)
      Java HotSpot(TM) 64-Bit Server VM (build 9+181, mixed mode)

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :

       java.text.NumberFormat.getInstance(new Locale("fi", "FI")).parse("-1,5")

      Should produce: -1.5
      Produces: ParseException (see Description)


      ACTUAL -
      java.text.ParseException thrown: Unparseable number: "-1,5"
      at NumberFormat.parse (NumberFormat.java:393)
      at (#4:1)

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
       java.text.NumberFormat.getInstance(new Locale("fi", "FI")).parse("-1,5")
      ---------- END SOURCE ----------

            psonal Pallavi Sonal (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: