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

[Fmt-Nu] NumberFormat.setMaximumFractionDigits set to Integer.MAX_VALUE causes mem. leak

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: P5 P5
    • None
    • 5.0
    • core-libs
    • None
    • sparc
    • solaris_8

      I am attaching a test case written by Santiago Pericas-Geertsen. This affects the xsltc tests causing OutOfMemory problems. According to Norbert this may be a regression caused by 4018937
      //
      // Written by ###@###.###
      //

      import java.text.DecimalFormat;
      import java.text.NumberFormat;
      import java.util.Locale;

      public final class Test {

          public static void main(String[] args) throws Exception {
              NumberFormat f = NumberFormat.getInstance(Locale.getDefault());
              /*
               * In earlier JDK's it was OK to use MAX_VALUE to avoid truncation.
               * In Tiger, this causes toPattern() to loop and run out of memory.
               * (c.f. line 2194 of java.text.DecimalFormat.java) I haven't
               * checked the Javadoc for Tiger, but it this has changed it will
               * not be backward compatible with earlier JDK's.
               */
              f.setMaximumFractionDigits(Integer.MAX_VALUE);
              String p = ((DecimalFormat) f).toPattern();
          }
      }

            peytoia Yuka Kamiya (Inactive)
            bhamehta Bhakti Mehta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: