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

awt.List.getMinimumSize(int rows) w/ param < 0 get negative height

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Won't Fix
    • Icon: P4 P4
    • 8-pool
    • 6
    • client-libs
    • sparc
    • solaris_2.6

      awt.List.getMinimumSize(int rows) (Also deprecated method minimumSize),
      when the rows param is less than zero the returned Dimension object has a
      height value that is negative. A negative row value should not be allowed, should get some kind of exception thrown (i.e. IllegalArgumentException).

      /*
       * @(#)GetMinimumSizeTest.java
       * @author JTG East 5/26/99
       * @version 1.0
       * @bug
       *
       * java.awt.List.getMinimumSize method tests
       */

      import java.awt.*;
      import java.io.*;

      public class GetMinimumSizeTest extends Frame
      {
         List l;

         GetMinimumSizeTest()
         {
            super("minimumSize() Test");
            l = new List();
         }

         public static void main(String[] args)
         {
            if( bound() )
            {
               System.out.println("Test for List.getMinimumSize Failed");
               System.exit(1);
            }
            else
            {
               System.out.println("Test for List.getMinimumSize Passed");
               System.exit(0);
            }
         }
                
         public static boolean bound()
         {
            //Test method with boundry conditions
            GetMinimumSizeTest m = new GetMinimumSizeTest();
            Dimension d = new Dimension();
            boolean fail = false;

            m.setSize(400, 400);
            m.setVisible(true);
            m.add(m.l);

            d = m.l.getMinimumSize(-1); /* bug returns negative height value */
            //d = m.l.minimumSize(-1);

            System.out.println("getMinimumSize return: " + d);

            if( (d.width <= 0) || (d.height <= 0) )
            {
               System.out.println("fail");
               fail = true;
            }
            return fail;
         }
      }

            bagiras Oleg Pekhovskiy (Inactive)
            mcolburnsunw Michael Colburn (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: