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

XMLGregorianCalendar.setTimeZone(null) does not throw NPE

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      Name: erR10175 Date: 11/18/2003


       
        The following method of the class javax.xml.datatype.XMLGregorianCalendar
        
      public final void setTimeZone(TimeZone value)

      does not throw NullPointerException if the value is null but the documentation
      of the method reads:

      "Throws: NullPointerException - if the TimeZone is null"

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

      The bug is found in jdk1.5.0/beta/b28.

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

      class test {
          public static void main(String [] args) {
              XMLGregorianCalendar calendar = new XMLGregorianCalendar();
              try {
                  calendar.setTimeZone(null);
                  System.out.println("setTimeZone(null) does not throw NullPointerException");
              } catch (NullPointerException e) {
                  System.out.println("OK");
              }
          }
      }
      ----------------------------------------------------

      ------------------------------------------------ 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-b28)
      Java HotSpot(TM) Client VM (build 1.5.0-beta-b28, mixed mode)

      setTimeZone(null) does not throw NullPointerException
      ----------------------------------------------------

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

        Attachments

          Activity

            People

            Assignee:
            jfialli Joe Fialli
            Reporter:
            reysunw Rey Rey (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: