GeoTools
  1. GeoTools
  2. GEOT-2634

Not correct parsing of Date from XML

    Details

    • Type: Bug Bug
    • Status: Open Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 2.2.3
    • Fix Version/s: 2.7.6
    • Component/s: xml
    • Labels:
      None

      Description

      There is an error in class org.geotools.xml.xsi.Date in method getValue(Element, ElementValue[], Attributes, Map).

      Calendar class is used to retrieve a Date from String. In Calendar months are indexed from 0 but this is not taken into account by GeoTools.
      If we get in the XML first of January: 2009-01-01 it is parsed to a date object 2009-02-01. January is indexed 0 in Calendar class, 1 is February.

        Activity

        Hide
        Andrea Aime added a comment -
        Yeah, correct. It would be great if you could add a patch and a test case.
        Show
        Andrea Aime added a comment - Yeah, correct. It would be great if you could add a patch and a test case.
        Hide
        Roy Braam added a comment -
        Patch for correct date.
        Show
        Roy Braam added a comment - Patch for correct date.
        Hide
        Roy Braam added a comment - - edited
        You're still the module maintainer? Or shall i commit it?
        Show
        Roy Braam added a comment - - edited You're still the module maintainer? Or shall i commit it?
        Hide
        Panagiotis Skintzos added a comment -
        This is a lethal bug!
        In a client app (uDig in my case), all the dates coming from a WFS query are one month off !
        Combined with the missing timezone info in the server output (Geoserver - wfs 1.0) , the dates are completely unusable.

        It appears in 8.0x versions as well.

        The fix is very simple, just subtract 1 from the month.
        The same fix should be applied in XSISimpleTypes.DateTime
        Show
        Panagiotis Skintzos added a comment - This is a lethal bug! In a client app (uDig in my case), all the dates coming from a WFS query are one month off ! Combined with the missing timezone info in the server output (Geoserver - wfs 1.0) , the dates are completely unusable. It appears in 8.0x versions as well. The fix is very simple, just subtract 1 from the month. The same fix should be applied in XSISimpleTypes.DateTime
        Hide
        Panagiotis Skintzos added a comment -
        I attached two patches that fix the issue for Date, DateTime and Duration parsing, in 8.0-M4 and 2.7.4
        Show
        Panagiotis Skintzos added a comment - I attached two patches that fix the issue for Date, DateTime and Duration parsing, in 8.0-M4 and 2.7.4
        Hide
        Panagiotis Skintzos added a comment -
        I corrected the patches (had to swap the input order) these are the right ones
        Show
        Panagiotis Skintzos added a comment - I corrected the patches (had to swap the input order) these are the right ones
        Hide
        Panagiotis Skintzos added a comment -
        Hi, any progress on this issue? Please, this is very important.
        I've submitted the patches. Should I make a pull request in github?
        Show
        Panagiotis Skintzos added a comment - Hi, any progress on this issue? Please, this is very important. I've submitted the patches. Should I make a pull request in github?
        Hide
        Andrea Aime added a comment -
        Patches like this one get reviewed and applied in the core developers spare time, I guess so far other issues have taken priority over this one
        Show
        Andrea Aime added a comment - Patches like this one get reviewed and applied in the core developers spare time, I guess so far other issues have taken priority over this one

          People

          • Assignee:
            Jody Garnett
            Reporter:
            Michal Maniecki
          • Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated: