-
Bug
-
Resolution: Fixed
-
P3
-
1.4.0
-
beta2
-
sparc
-
solaris_2.6
Name: dsR10051 Date: 03/21/2001
Method public Component add(Component comp, int index)
of class java.awt.Container can throw undocumented
ArrayIndexOutOfBoundsException when component is added twice.
Here is minimized test:
import java.awt.*;
public class Test2 {
public static void main(String argv[]) {
Panel p=new Panel();
int[] values = {0,1};
Canvas comp = new Canvas();
for(int i=0;i<values.length;i++) {
System.out.println(values[i]);
p.add(comp,values[i]);
}
}
}
--- Output ---
%java -version
java version "1.4.0-beta"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-beta-b55)
Java HotSpot(TM) Client VM (build 1.4beta-B55, mixed mode)
%java Test2
0
1
Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException
at java.lang.System.arraycopy(Native Method)
at java.awt.Container.addImpl(Container.java:461)
at java.awt.Container.add(Container.java:344)
at Test2.main(Test2.java:11)
======================================================================