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

Some methods in class java.util.LinkedList don't describe the behaviour for null

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 1.4.0
    • 1.1.3, 1.3.0
    • core-libs
    • rc1
    • generic, sparc
    • generic, solaris_2.5
    • Verified

      Current specification for some constructors and methods doesn't describe the behaviour for null input, but the current implementation does throw NullPointerExcepion. This problem happens on the following constructor and methods: LinkedList(Collection c), addAll(Collection c), addAll(int index, Collection c).

      For example, when I set null to Collection for those Constructor and methods, I got NullPointerException when the constructor or methods got invoked.





      Name: krC82822 Date: 01/17/2001


      17 Jan 2001, eval1127@eng -- see also #4378421
      ----------------
      java version "1.3.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
      Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)

      java.util.ArrayList.addAll(Collection c) assumes that the collection passed in
      is not null. If it is null, a NullPointerException will be thrown.

      The documentation does not make it clear whether or not it is reasonable to
      pass null into this method.
      (Review ID: 115293)
      ======================================================================

            jjb Josh Bloch (Inactive)
            hji Huafang Ji (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: