aboutsummaryrefslogtreecommitdiffstats
path: root/src/ooxml/java/org/apache/poi/openxml4j
diff options
context:
space:
mode:
authorAndreas Beeker <kiwiwings@apache.org>2015-10-04 00:35:30 +0000
committerAndreas Beeker <kiwiwings@apache.org>2015-10-04 00:35:30 +0000
commit012cfb107cc9b72f962085c284467a8907f48794 (patch)
treedf90bbeaf051cb2bc68bf3410ce0b9b6b99275e3 /src/ooxml/java/org/apache/poi/openxml4j
parent6d5e89298648e480c29747ba878cc0ea35f263a3 (diff)
downloadpoi-012cfb107cc9b72f962085c284467a8907f48794.tar.gz
poi-012cfb107cc9b72f962085c284467a8907f48794.zip
sonar fixes
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1706648 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/ooxml/java/org/apache/poi/openxml4j')
-rw-r--r--src/ooxml/java/org/apache/poi/openxml4j/opc/internal/PackagePropertiesPart.java12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/PackagePropertiesPart.java b/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/PackagePropertiesPart.java
index 26331fbccf..1d957e5a59 100644
--- a/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/PackagePropertiesPart.java
+++ b/src/ooxml/java/org/apache/poi/openxml4j/opc/internal/PackagePropertiesPart.java
@@ -559,20 +559,18 @@ public final class PackagePropertiesPart extends PackagePart implements
* @throws InvalidFormatException
* Throws if the date format isnot valid.
*/
- private Nullable<Date> setDateValue(String s) throws InvalidFormatException {
- if (s == null || s.equals("")) {
+ private Nullable<Date> setDateValue(String dateStr) throws InvalidFormatException {
+ if (dateStr == null || dateStr.equals("")) {
return new Nullable<Date>();
}
- if (!s.endsWith("Z")) {
- s += "Z";
- }
+ String dateTzStr = dateStr.endsWith("Z") ? dateStr : (dateStr + "Z");
SimpleDateFormat df = new SimpleDateFormat(DEFAULT_DATEFORMAT, Locale.ROOT);
df.setTimeZone(LocaleUtil.TIMEZONE_UTC);
- Date d = df.parse(s, new ParsePosition(0));
+ Date d = df.parse(dateTzStr, new ParsePosition(0));
if (d == null) {
df = new SimpleDateFormat(ALTERNATIVE_DATEFORMAT, Locale.ROOT);
df.setTimeZone(LocaleUtil.TIMEZONE_UTC);
- d = df.parse(s, new ParsePosition(0));
+ d = df.parse(dateTzStr, new ParsePosition(0));
}
if (d == null) {
throw new InvalidFormatException("Date not well formated");