Sling Post servlet incorrectly parses ISO8601 date formats with timezone offset 
(as used by JCR)
------------------------------------------------------------------------------------------------

                 Key: SLING-1206
                 URL: https://issues.apache.org/jira/browse/SLING-1206
             Project: Sling
          Issue Type: Bug
          Components: Servlets
    Affects Versions: Servlets Post 2.0.2, Servlets Post 2.0.4
            Reporter: Alexander Klimetschek
            Priority: Minor


An ISO8601 date format, as it is returned by javax.jcr.Property.getString() for 
date properties, looks like this:

    2009-11-18T11:30:00+10:30

When roundtripping this string by posting it to the sling post servlet (using 
@TypeHint=Date), it will be parsed by this pattern "yyyy-MM-dd'T'HH:mm:ss", 
configured as third in the SlingPostServlet's servlet.post.dateFormats config. 
But then timezone information is lost and the default timezone of the server 
will be used, which produces a wrong date in the end.

The problem is that Java's SimpleDateFormat used in the SlingPostServlet 
(DateParser class), does not support the ISO8601 way of specifying timezone 
offsets at all. It either supports "GMT+10:30", where "GMT" must be present, or 
the RFC-822 style "+1030", without the colon.

To support proper round-tripping, with date strings rendered directly from a 
JCR property, I suggest to
a) introduce a special pattern string such as "iso8601" that uses the ISO8601 
utility class from jackrabbit-jcr-commons
b) set this format as second one in the servlet.post.dateFormats list (before 
the problematic ones, but after the ECMA date format, which is needed for 
roundtripping with Sling JSON exports)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to