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

java.util.Hashtable ctor doesn't throw IllegalArgumentException

    XMLWordPrintable

Details

    Description



      Name: dfC67450 Date: 07/12/99


      Javadoc specs for
      java.util.Hashtable(int initialCapacity, float loadFactor) states:
        "Throws: IllegalArgumentException - if initial capacity is less than
          zero or if the load factor is nonpositive."

      However, in JDK 1.2.2 this method does not throw IllegalArgumentException
      if load factor equal to Float.NaN is passed.

      Here is the example demonstrating the bug:

      ------------- Test.java -------------------------
      import java.util.Hashtable;
      public class Test {
          public static void main(String[] args) {
              try {
                  Hashtable table = new Hashtable(0, Float.NaN);
                  System.out.println("FAILED: IllegalArgumentException expected.");
                  return;
              } catch (IllegalArgumentException e) {
              }

              System.out.println("PASSED.OKAY");
          }
      }
      ------ Output under JDK 1.2.2 -------
      FAILED: IllegalArgumentException expected.

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

      Attachments

        Issue Links

          Activity

            People

              mmcclosksunw Michael Mccloskey (Inactive)
              fdasunw Fda Fda (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: