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

REGRESSION: DecimalFormat.toPattern() causes OutOfMemoryError

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P3 P3
    • None
    • 5.0
    • core-libs
    • x86
    • windows_xp

      FULL PRODUCT VERSION :
      JDK 1.5 update 6

      ADDITIONAL OS VERSION INFORMATION :
      Happens in Windows XP and Linux. This isn't an OS specific problem.

      A DESCRIPTION OF THE PROBLEM :
      DecimalFormat with empty string causes OutOfMemoryError: Java heap space in toPattern method.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
            DecimalFormat df = new DecimalFormat("");
            System.out.println(df.toPattern());

      Under JDK 1.4.2, this returns:

      #,###.##########################################################################
      ################################################################################
      ################################################################################
      ################################################################################
      ##########################

      Under JDK 1.5 06, this causes the following exception:

      Exception in thread "main" java.lang.OutOfMemoryError: Java heap space

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      #,###.##########################################################################
      ################################################################################
      ################################################################################
      ################################################################################
      ##########################

      ACTUAL -
      Exception in thread "main" java.lang.OutOfMemoryError: Java heap space

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Exception in thread "main" java.lang.OutOfMemoryError: Java heap space

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.text.DecimalFormat;
      public class TestDecimalFormat {
        public static void main(String[] args) {
          DecimalFormat df = new DecimalFormat("");
          System.out.println(df.toPattern());
        }
      }

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

      Release Regression From : 1.4.2_10
      The above release value was the last known release where this
      bug was known to work. Since then there has been a regression.

            peytoia Yuka Kamiya (Inactive)
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: