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

ZoneView.setMaxZonesLoaded(int) does not specify behavior for negative params

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.4.0
    • docs
    • generic, sparc
    • generic, solaris_2.6



      Name: dsR10051 Date: 07/05/2000



      The documentation for method
      public void setMaxZonesLoaded(int mzl)
      of the javax.swing.text.ZoneView class
      does not specify the behavior for negative parameters.
      This method accepts negative mzl under jdk1.3 and throws
      ArrayIndexOutOfBoundsException under jdk1.4.

      Please specify the correct behavior or document
      that mlz parameter should be greater than or equals to zero.

      Here is a minimized test:
      import javax.swing.text.*;

      public class ZoneViewTest06 {
          public static void main (String[] args) {

              Document document = new DefaultStyledDocument();

              ZoneView zone = new ZoneView(document.getDefaultRootElement(), View.X_AXIS);
              int mlz = -1;
              zone.setMaxZonesLoaded(mlz);
              System.out.println(zone.getMaxZonesLoaded());
          }
      }
      --- Output ---
      %/usr/local/java/jdk1.3/solaris/bin/java ZoneViewTest06
      -1
      %/usr/local/java/jdk1.4/solaris/bin/java ZoneViewTest06
      Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 0 >= 0
              at java.util.Vector.elementAt(Vector.java:417)
              at javax.swing.text.ZoneView.unloadOldZones(ZoneView.java:140)
              at javax.swing.text.ZoneView.setMaxZonesLoaded(ZoneView.java:120)
              at ZoneViewTest06.main(ZoneViewTest06.java:10)
      %

      ======================================================================

            sharonz Sharon Zakhour (Inactive)
            sdasunw Sda Sda (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: