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

java.util.Hashtable ctor doesn't throw IllegalArgumentException

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P3 P3
    • None
    • 1.2.0
    • core-libs



      Name: asC58863 Date: 12/22/97


      java.util.Hashtable(int, float) doesn't throw an IllegalArgumentExcetion
      in case the initialCapacity equals to zero.

      (see JavaDoc Comment )
      "public Hashtable(int initialCapacity,
                        float loadFactor)
      .....................................
            Throws: IllegalArgumentException
                  if the initial capacity is less than or equal to zero, <....>"

      The bug has been introduced into JDK1.2beta3-A release.

      JCK114Á test tests/api/java_util/Hashtable/HahstableTests.html#HashtableTests61
      fails due to this bug.

      Here is the test demonstrating the bug:
      -----------------Test.java------------------------
      import java.util.*;

      class Test {
       public static void main(String[] argv) {
         try {
          Hashtable hashtable = new Hashtable( 0, 0.5f);
          System.out.println(" Failed : IllegalArgumentException has not been thrown");
         } catch(IllegalArgumentException e) {
          System.out.println(" Passed : OKAY ");
         }
       }
      }
      ---------Output from the test---------------------

       Failed : IllegalArgumentException has not been thrown
       
      --------------------------------------------------
         
      ======================================================================

            mmcclosksunw Michael Mccloskey (Inactive)
            asemidetsunw Alexei Semidetnov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: