Community
Participate
Working Groups
The DATE_FORMAT in org.eclipse.mylyn.internal.tasks.core.externalization.DelegatingTaskExternalizer currently uses three-letter time zone ID, which may causes incorrect Date objects being set, as the same three-letter time zone ID is often used for multiple time zones. For example, if creating a task in "China Standard Time", the date will be saved as in "CST" time zone. But when it's being read and parsed, Java will recognize the date string as in "Central Standard Time". Using RFC 822 time zone format instead could be considered (http://download.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html#rfc822timezone).
Thanks for pointing that out. We should fix this. Mike, are you interested in providing a patch and test case to fix this?
Sure! (I don't have the permission to change assignee field nor the status though...)
Great to hear. I have assigned the task to you.
Created attachment 193500 [details] change timezone format to RFC 822 for externalizer Sorry Steffen, I've tried but still not sure how to write a test case to simulate the timezone change. It'd be great if you could help me with that. Thanks!
I recommend TaskListExternalizationTest as a starting point. You can use TimeZone.setDefault(TimeZone.getTimeZone("TZID")) to modify the time zone when running tests. Here is another related bug that you may also want to look at: 250865: scheduled dates should use UTC timestamps https://bugs.eclipse.org/bugs/show_bug.cgi?id=250865 I haven't checked in detail so it might be a much larger scope and require significantly more effort and should probably be done separately since the change proposed for this bug makes sense independently.
Created attachment 194783 [details] patch and test case Thanks Steffen for the tip! Provided a test case that would fail without the patch and pass with the patch.
Created attachment 195916 [details] updated patch
Created attachment 195917 [details] mylyn/context/zip
Thanks for the patch and test case Mike. I have modified the contribution to ensure that it is still possible to read older task lists that use the three letter format.
Created attachment 195922 [details] mylyn/context/zip
Thanks for reviewing the patch, Steffen! Per http://download.oracle.com/javase/6/docs/api/java/text/SimpleDateFormat.html#timezone , the RFC 822 also accepts general time zone format for parsing, so I'm wondering if there is another reason why general time zone format is preferred when reading Date's? Thanks!
Thanks for pointing that out. I missed that comment in the JavaDoc. In that case my modification was unnecessary.
You are welcome. Glad I could help! :)