java.util.Hashtable ctor doesn't throw IllegalArgumentException

XMLWordPrintable

    • Type: Bug
    • Resolution: Not an Issue
    • Priority: P3
    • None
    • Affects Version/s: 1.2.0
    • Component/s: 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
       
      --------------------------------------------------
         
      ======================================================================

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: