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)
%
======================================================================
- duplicates
-
JDK-4351854 jck_regr: api/javax_swing/text/ZoneView/index.html#getXXX
-
- Closed
-