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

GridBagLayout.minimumLayoutSize throws unexpected AIOOBE

XMLWordPrintable

    • b33
    • sparc
    • solaris_2.5
    • Verified

      Name: idR10193 Date: 01/14/2002


      Call to the method minimumLayoutSize of GridBagLayout leads to
      unexpected java.lang.ArrayIndexOutOfBoundsException (actually it
      happends in GetLayoutInfo).

      ============================== Start of addLC.java =======================
      import java.awt.*;

      public class addLC {

          public static void main(String argv[]) {
              GridBagLayout gbl = new GridBagLayout();
          
              Container parent = new Container();
              parent.setSize(801, 601);
              parent.setLayout(gbl);
          
              GridBagConstraints gbc = new GridBagConstraints();

              gbc.gridx = 0;
              gbc.gridy = Integer.MAX_VALUE;
              gbc.gridwidth = Integer.MAX_VALUE;
              gbc.gridheight = 0;
              gbc.anchor = GridBagConstraints.CENTER;
              gbc.weightx = 0;
              gbc.weighty = Double.MAX_VALUE;
              gbc.fill = GridBagConstraints.NONE;
              gbc.ipadx = 0;
              gbc.ipady = Integer.MAX_VALUE;
              Insets insets = new Insets(0, 1, 2, 3);
          
              Component comp = new Component(){};
              comp.setSize(40, 30);
          
              parent.add(comp, gbc);
          
              Dimension new_sz = gbl.minimumLayoutSize(parent);

              System.out.println(new_sz);
          }
      }
      ============================== End of AddLC.java =======================
      Output under JDK version "1.4.0-rc-b91" ===============================

      ~/bugs;
      javac addLC.java;java addLC
      Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException
              at java.awt.GridBagLayout.GetLayoutInfo(GridBagLayout.java:872)
              at java.awt.GridBagLayout.getLayoutInfo(GridBagLayout.java:791)
              at java.awt.GridBagLayout.minimumLayoutSize(GridBagLayout.java:640)
              at addLC.main(addLC.java:31)
      ~/bugs;
      =======================================================================

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

            dav Andrei Dmitriev (Inactive)
            idergali Ilya Dergalin (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: