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

javax.xml.datatype.Duration("P1M").equals(null) does not throws NullPointerExcep

XMLWordPrintable

    • 1.3
    • generic
    • generic

        Name: erR10175 Date: 10/24/2003



          The method javax.xml.datatype.Duration.equals(Object rhs) does not throw
        NullPointerException if the rhs parameter is null.

        The documentation of the method reads:
        "A NullPointerException is thrown if the rhs parameter is null."

        This bug affects new test in JCK 1.5 (not yet integrated)
           api/javax_xml/datatype/Duration/index.html#DurationTests[Equals002]

        To reproduce the bug compile and run the following code as shown
        in the log below:
        ------------------------------ test.java
        import javax.xml.datatype.Duration;

        public class test {
            public static void main(String [] args) {
                Duration d = new Duration("P1Y");
                System.out.println("d.equals(null) returns " + d.equals(null)
                                 + " instead of throwing NullPointerException");
            }
        }
        ----------------------------------------------------

        ------------------------------------------------ log
        $javac test.java
        $java -cp . -showversion test
        java version "1.5.0-beta"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b25)
        Java HotSpot(TM) Server VM (build 1.5.0-beta-b25, mixed mode)

        d.equals(null) returns false instead of throwing NullPointerException
        ----------------------------------------------------

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

              kkawagucsunw Kohsuke Kawaguchi (Inactive)
              reysunw Rey Rey (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: