https://bz.apache.org/bugzilla/show_bug.cgi?id=59780
Bug ID: 59780
Summary: SimpleDateFormat usage incorrect in
PackagePropertiesPart class
Product: POI
Version: 3.14-FINAL
Hardware: All
OS: All
Status: NEW
Severity: critical
Priority: P2
Component: POI Overall
Assignee: [email protected]
Reporter: [email protected]
Created attachment 34000
--> https://bz.apache.org/bugzilla/attachment.cgi?id=34000&action=edit
J-Unit Test for PackagePropertiesPart.setDate Method
We're facing an issue with the PackageProperties.setDateValue(String) method
while parsing a XLSX file containing a creation Date/Time of
"2016-06-28T16:26:46+03:00"
Upon inspection, there are quite a few issues with the formats used for
attempting to parse this ISO-8601 value.
This declaration
DEFAULT_DATEFORMAT = "yyyy-MM-dd'T'HH:mm:ss'Z'";
is declaring Time Zone format code of Z as a literal String instead of just
using Z.
The second declaration
ALTERNATIVE_DATEFORMAT ="yyyy-MM-dd'T'HH:mm:ss.SS'Z'";
has the same issue as the first, with the additional problem that the
Milliseconds values should be captured via "SSS" and not "SS".
Lastly, format Z only works with Time Zone offsets that do not contain ":"
characters in them, such as +0300 (vs +03:00). As of JDK 1.7, SimpleDateFormat
added code X to handle both.
Attached is a J-Unit test re-affirming the above along with a fix we're going
to be looking at applying locally until this is fixed.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]