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

java.text.ChoiceFormat.format() causes StackOverflowError

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      1.1fcs
    • CPU:
      x86
    • OS:
      generic
    • Verification:
      Not verified

      Description


      masayoshi.okutsu@Eng 1997-01-09
      java.text.ChoiceFormat.format(long, StringBuffer, FormatStatus) causes
      StackOverflowError. To reproduce, exec the following test program.

      import java.text.*;

      public class bug1{
          public static void main(String[] args){
      //
              double[] limit = {0.0,1.0,2.0};
              Object[] format = {"0.0<=Limit<1.0",
                                  "1.0<=Limit<2.0",
                                  "2.0<=Limit"};
              ChoiceFormat cf = new ChoiceFormat(limit,format);
              FormatStatus status = new FormatStatus();
              StringBuffer toappendTo = new StringBuffer("");
      //
      // main
      //
      // System.out.println(cf.format((double)1.0,toappendTo,status)); // OK
              System.out.println(cf.format((long )1.0,toappendTo,status)); // NG
          }
      }

      Exec result:

      [F:\TEMP\text]java bug1
      java.lang.StackOverflowError
          at java.text.ChoiceFormat.format(ChoiceFormat.java:131)
          at java.text.ChoiceFormat.format(ChoiceFormat.java:131)
               ...
          (lots of iteration)
               ...
          at java.text.ChoiceFormat.format(ChoiceFormat.java:131)
          at java.text.ChoiceFormat.format(ChoiceFormat.java:131)
          at bug1.main(bug1.java:17)

        Attachments

          Activity

            People

            Assignee:
            bcbeck Brian Beck (Inactive)
            Reporter:
            okutsu Masayoshi Okutsu
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: