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

DecimalFormat wrong result when executed with param -XX:FlightRecorderOptions=96

    XMLWordPrintable

    Details

      Description

      ADDITIONAL SYSTEM INFORMATION :
      Execute Sample with Parameters:
      -Duser.region=DE
      -Duser.country=DE
      -Duser.language=de
      -XX:FlightRecorderOptions=stackdepth=96

      A DESCRIPTION OF THE PROBLEM :
      If Program is started with Parameter -XX:FlightRecorderOptions=stackdepth=96
             new DecimalFormat(",##0.00").format(1234.56));
      returns wrong result (at least for German locale).
      Expected: 1.234,56 Actual: 1,234.56

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Execute Sample with:
      -Duser.region=DE
      -Duser.country=DE
      -Duser.language=de
      -XX:FlightRecorderOptions=stackdepth=96

      Expected: 1.234,56 Actual: 1,234.56

      Remove parameter -XX:FlightRecorderOptions=stackdepth=96, re-execute:
      Expected: 1.234,56 Actual: 1.234,56


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      DecimalFormat df = new DecimalFormat(",##0.00");
      assertEquals("1.234,56", df.format(1234.56));

      ACTUAL -
      DecimalFormat df = new DecimalFormat(",##0.00");
      assertEquals("1.234,56", df.format(1234.56));

      Fails, Actual result: 1,234.56

      ---------- BEGIN SOURCE ----------
      import static org.junit.Assert.assertEquals;
      import java.text.DecimalFormat;
      import java.util.Locale;
      import org.junit.Test;

      public class ReproduceDecimalFormatErrorTest {

      @Test
      public void testDecimalFormatter() {

      System.out.println("Locale: " + Locale.getDefault());
      System.out.println(
      "decSep: " + java.text.DecimalFormatSymbols.getInstance(Locale.getDefault()).getDecimalSeparator()
      + " und GroupSep: '"
      + java.text.DecimalFormatSymbols.getInstance(Locale.getDefault()).getGroupingSeparator() + "'");

      DecimalFormat df = new DecimalFormat(",##0.00");

      assertEquals("1.234,56", df.format(1234.56));
      }
      }

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

      CUSTOMER SUBMITTED WORKAROUND :
      Remove Start Parameter -XX:FlightRecorderOptions=stackdepth=96

      FREQUENCY : always


        Attachments

          Activity

            People

            Assignee:
            tongwan Andrew Wang
            Reporter:
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: