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

XMLGregorianCalendar.toXMLFormat() uses broken format

XMLWordPrintable

    • b35
    • generic
    • generic
    • Verified



      Name: erR10175 Date: 12/22/2003


       
        The following method of the class javax.xml.datatype.XMLGregorianCalendar
        
      public String toXMLFormat()

      returns invalid strings for valid values.

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

      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 calendar
                  = XMLGregorianCalendar.createDate(1970, 1, 1, 300);
              String returned = calendar.toXMLFormat();
              if ("1970-01-01+05:00".equals(returned)) {
                  System.out.println("OK");
              } else {
                  System.out.println("Failed: returned " + returned
                                   + ", expected 1970-01-01+05:00");
              }
          }
      }
      ----------------------------------------------------

      ------------------------------------------------ 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: returned 1970-01-03/12/19z, expected 1970-01-01+05:00
      ----------------------------------------------------

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

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: