[MAGNOLIA-5937] PropertyUtil#createValue does not properly parse iso8601 date strings Created: 01/Oct/14  Updated: 10/Mar/21

Status: Open
Project: Magnolia
Component/s: None
Affects Version/s: 5.3.3
Fix Version/s: None

Type: Bug Priority: Neutral
Reporter: Christopher Zimmermann Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Relates
relates to MGNLUI-3123 Date property change in JCR browser d... Closed
relation
is related to MAGNOLIA-4441 Review util classes Open
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:

 Description   

For example it cannot process this date string: 2014-10-01T13:11:27.000+02:00
It fails in parsing the seconds as it tries to convert '27.000+02' to an int.

A possible replacement for the entire try block would be DatetypeConverter#parseDateTime.
(http://docs.oracle.com/javase/6/docs/api/javax/xml/bind/DatatypeConverter.html#parseDateTime%28java.lang.String%29)
See http://stackoverflow.com/questions/12201233/convert-iso8601-string-date-time-format-to-date-in-java

You can reproduce this by:
Opening the JCRBrowser to /demo-project/news-and-events/events-overview/new-year-s-eve@dateEnd
Switch type to a string.
Switch type back to a date.
It will now show the current date since the string to date conversion failed.



 Comments   
Comment by Tobias Mattsson [ 11/Mar/16 ]

We're using org.apache.jackrabbit.util.ISO8601 from jackrabbit-jcr-commons elsewhere in the code base. It should be used here as well and will fix the issue.

Generated at Mon Feb 12 04:09:48 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.