JiBX
  1. JiBX
  2. JIBX-185

JibxException thrown from org.jibx.runtime.Utility when attempting to deserializeDate on valid xml schema date format.

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: JiBX 1.1.5
    • Fix Version/s: None
    • Component/s: core
    • Labels:
      None
    • Environment:
      mac osx w/ Java 1.5
    • Testcase included:
      yes
    • Number of attachments :
      0

      Description

      according to w3c xml schema spec, date formats can be defined as 'YYYY-MM-DD-hh:mm".

      When attempting to deserialize this format using the org.jibx.runtime.Utility deserializeDate method, a jibxexception is thrown upon validation.

      Below is a simple testcase showing this.... I poked around the source and found that the validateDate method does not recognize this format as a valid date format.

      package foo.test.jibx;

      import junit.framework.TestCase;
      import org.jibx.runtime.Utility;
      import org.jibx.runtime.JiBXException;
      import java.util.Date;

      public class JibxDateFormatTest extends TestCase
      {
      public void testDateSerializationWithTimeZone() throws Exception
      {
      String dateStr = "1950-10-01-02:00";
      try

      { Date date = Utility.deserializeDate(dateStr); assertNotNull(date); }

      catch (JiBXException ex)

      { ex.printStackTrace(); assertTrue(false); }

      }
      }

        Activity

        Hide
        Dennis Sosnoski added a comment -

        The schema specification gives the dateTime format as CCYY-MM-DDThh:mm:ss, and says "The CCYY field must have at least four digits, the MM, DD, SS, hh, mm and ss fields exactly two digits each (not counting fractional seconds); leading zeroes must be used if the field would otherwise have too few digits." Your sample is missing the required seconds component.

        Show
        Dennis Sosnoski added a comment - The schema specification gives the dateTime format as CCYY-MM-DDThh:mm:ss, and says "The CCYY field must have at least four digits, the MM, DD, SS, hh, mm and ss fields exactly two digits each (not counting fractional seconds); leading zeroes must be used if the field would otherwise have too few digits." Your sample is missing the required seconds component.

          People

          • Assignee:
            Dennis Sosnoski
            Reporter:
            Hardip Singh
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: