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

poor doc for ctor javax.swing.SizeSequence.SizeSequence(int)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.4.0
    • 1.3.0
    • docs
    • beta
    • sparc
    • solaris_2.6



      Name: sdC67446 Date: 09/20/99


      The doc for ctor javax.swing.SizeSequence.SizeSequence(int numEntries)
      says nothing about expected behavior if 'numEntries' < 0.
      Currently constructor throws NegativeArraySizeException.

      The doc says:
      ------------------------------------------------------------
      public SizeSequence(int numEntries)

           Creates a new SizeSequence object that contains the specified
           number of entries, all initialized to have size 0.
           Parameters:
               numEntries - the number of sizes to track

      The demo test:
      ------------------------------------------------------------
      public class Test {
          public static void main(String argv[]) {
              new javax.swing.SizeSequence(-1);
          }
      }

      Output:
      ------------------------------------------------------------
      Exception in thread "main" java.lang.NegativeArraySizeException
              at javax.swing.SizeSequence.insertEntries(SizeSequence.java:316)
              at javax.swing.SizeSequence.<init>(SizeSequence.java:149)
              at javax.swing.SizeSequence.<init>(SizeSequence.java:136)
              at Test.main(Test.java:3)
      ------------------------------------------------------------

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

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: