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

XMLGregorianCalendar.parse incorrectly parses milliseconds

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b35
    • CPU:
      generic
    • OS:
      generic
    • Verification:
      Verified

      Description

      Name: erR10175 Date: 12/26/2003


       
        The following method of the class javax.xml.datatype.XMLGregorianCalendar

      public static XMLGregorianCalendar parse(String lexicalRepresentation)

      incorrectly parses milliseconds. Parsing the valid dateTime '2000-01-16T00:00:00.01'
      the method sets the field Millisecond to 1 instead of 10.

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

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

      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 c
                  = XMLGregorianCalendar.parse("2000-01-16T00:00:00.01");
              int millisecond = c.getMillisecond();
              if (millisecond != 10) {
                  System.out.println("Failed: c.getMillisecond() returned "
                      + millisecond + ", expected 10");
              } else {
                  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-b32)
      Java HotSpot(TM) Client VM (build 1.5.0-beta-b32, mixed mode)

      Failed: c.getMillisecond() returned 1, expected 10
      ----------------------------------------------------

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

        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: