Details

    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 6u22
    • Fix Version/s: None
    • Component/s: xml
    • Labels:
    • Subcomponent:
    • CPU:
      x86
    • OS:
      windows_xp

      Description

      FULL PRODUCT VERSION :
      java version "1.6.0_02"
      Java(TM) SE Runtime Environment (build 1.6.0_02-b05)
      Java HotSpot(TM) Client VM (build 1.6.0_02-b05, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Windows XP Professional SP3

      A DESCRIPTION OF THE PROBLEM :
      Bad XML Data time format produced by class XMLGregorianCalendar.

      Actual format is:
      '[0-9]{4}-[0-9]{2}-[0-9]{2}(T[0-9]{2}:[0-9]{2}(:[0-9]{2}(\.[0-9]{3})?((-|\+)[0-9]{2}:[0-9]{2})?)?)?'

      Must be:
      '[0-9]{4}-[0-9]{2}-[0-9]{2}(T[0-9]{2}:[0-9]{2}(:[0-9]{2}(\.[0-9]{6})?((-|\+)[0-9]{2}:[0-9]{2})?)?)?'

      In milliseconds must be add tree zeros 000, see:
      http://www.w3.org/TR/xmlschema-2/#dateTime-order
      3.2.7.1 Lexical representation

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :

      XMLGregorianCalendar cal = DatatypeFactory.newInstance().newXMLGregorianCalendar(new GregorianCalendar());
      System.out.println(cal.toXMLFormat());

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      2010-10-26T18:40:41.265000-05:00
      ACTUAL -
      2010-10-26T18:40:41.265-05:00

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.util.GregorianCalendar;

      import javax.xml.datatype.DatatypeConfigurationException;
      import javax.xml.datatype.DatatypeFactory;
      import javax.xml.datatype.XMLGregorianCalendar;


      public class Testmain {

      public static void main(String[] args) {

      try {
      XMLGregorianCalendar cal = DatatypeFactory.newInstance().newXMLGregorianCalendar(new GregorianCalendar());
      System.out.println(cal.toXMLFormat());
      } catch (DatatypeConfigurationException e) {

      e.printStackTrace();
      }
      }

      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Make my own class date time formatter.

        Attachments

          Activity

            People

            • Assignee:
              joehw Joe Wang
              Reporter:
              webbuggrp Webbug Group
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Imported:
                Indexed: