Uploaded image for project: 'Axis2'
  1. Axis2
  2. AXIS2-5028

XmlBeans DateOrTimeOrDateTime generated from OTA simple type does not comply with W3C standard

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Critical
    • Resolution: Invalid
    • Affects Version/s: 1.5.4
    • Fix Version/s: None
    • Component/s: databinding
    • Labels:
      None
    • Environment:
      Windows XP, Eclispe IDE

      Description

      The generated type DateOrTimeOrDateTime from OTA simple type DateOrTimeOrDateTimeType (OTA_SimpleTypes.xsd) doesn't accept 24 as a valid value for the hour field.

      W3C XML Schema Part 2: Datatypes Second Edition (ref. http://www.w3.org/TR/xmlschema-2/#dateTime) states that "'24' is permitted if the minutes and seconds represented are zero, and the dateTime value so represented is the first instant of the following day".

      Code below raises an exception: "union value '24:00:00' does not match any members of 'DateOrTimeOrDateTimeType in namespace http://www.opentravel.org/OTA/2003/05'"

      java.util.Calendar calendar = java.util.Calendar.getInstance();
      calendar.set(2000, 1, 1, 24, 0, 0);
      java.text.SimpleDateFormat format= new SimpleDateFormat("kk:mm:ss");
      org.opentravel.www.ota._2003._05.DateOrTimeOrDateTimeType aDate = org.opentravel.www.ota._2003._05.DateOrTimeOrDateTimeType.Factory.newInstance();
      aDate.setStringValue(format.format(calendar.getTime()));

      Full stacktrace:

      org.apache.xmlbeans.impl.values.XmlValueOutOfRangeException: union value '24:00:00' does not match any members of 'DateOrTimeOrDateTimeType in namespace http://www.opentravel.org/OTA/2003/05'
      at org.apache.xmlbeans.impl.values.XmlUnionImpl.set_text(XmlUnionImpl.java:154)
      at org.apache.xmlbeans.impl.values.XmlObjectBase.update_from_wscanon_text(XmlObjectBase.java:1135)
      at org.apache.xmlbeans.impl.values.XmlObjectBase.set_String(XmlObjectBase.java:1080)
      at org.apache.xmlbeans.impl.values.XmlObjectBase.set(XmlObjectBase.java:1637)
      at org.apache.xmlbeans.impl.values.XmlObjectBase.setStringValue(XmlObjectBase.java:1533)

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              yguerro Yoann Guerro
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: