Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Critical
-
Resolution: Unresolved
-
Affects Version/s: Test 0.2.0
-
Fix Version/s: None
-
Component/s: swizzle-confluence
-
Labels:None
-
Number of attachments :
Description
"SimpleDateFormat is a concrete class for formatting and parsing dates in a locale-sensitive manner."
http://java.sun.com/j2se/1.4.2/docs/api/java/text/SimpleDateFormat.html
This means that depending on the place in this world where the user is located the decoding will succeed or fail. This is unacceptable, and it also happens in the functional tests for swizzle-jira (on my machine the tests fail because of a different locale of the server).
Issue Links
- is related to
-
SWIZZLE-38
Tests are failing due to a bad timezone
-
Two patches for the language problem.
The first one generates all the different SimpleDateFormat in all the possible Locales.
A defaultFormat variable keeps the last format that was able to parse a date, so that a lookup is not necessary at each conversion. Here the hypothesis is that it is likely that when a date is parsed all the following dates will be in the same format (unless we are using different confluence servers in different languages at the same time). In this case the lookup will do the job.
Maybe an overkill solution (takes 2.5 secs on my machine for generating the list) but it should do the job and is a brute force solution.
The second one, simply forces all the serialization/deserialization to be in Locale.US.
This should work fine if the server always serializes in Locale.US (Apache XMLRPC does this).
I didn't try with Confluence run in a given locale to see how it sends dates.