Uploaded image for project: 'XMLBeans'
  1. XMLBeans
  2. XMLBEANS-588

GDate can return diferent values on different current timezones

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • Version 5.1.0
    • None
    • None

    Description

      When using Saxon XPath processor in order to retrieve a date value for example:

      XmlObject o = XmlObject.Factory.parse("<a/>");
      XmlObject[] res = o.selectPath("xs:date(\"2000-01-01\")");
      GDate gdate = ((XmlDate) res[0]).getGDateValue();
      assertEquals(gdate.getYear(), 2000);

      fails is the current timezone has a negative offset, for example US/Eastern.

      The problem arises because SaxonXPath uses internally a method that returns java.util.Date instances and those always has a timezone attached. Maybe the GDate should not come from a Date resulting from the invocation of SequenceTool.convertToJava() in SaxonXPath 

      GDate should contain the exact date without timezone problems, it could probably should not be instantiated from a Date coming from Saxon, but from the native Saxon Date representation

      Attachments

        Activity

          People

            Unassigned Unassigned
            robmv Robert Marcano
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 50m
                50m