You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by GitBox <gi...@apache.org> on 2021/06/07 11:35:56 UTC

[GitHub] [jackrabbit-filevault] jsedding commented on a change in pull request #143: JCRVLT-526 PackageProperties timezone format extension

jsedding commented on a change in pull request #143:
URL: https://github.com/apache/jackrabbit-filevault/pull/143#discussion_r646507030



##########
File path: vault-core/src/main/java/org/apache/jackrabbit/vault/packaging/impl/PackagePropertiesImpl.java
##########
@@ -211,22 +216,34 @@ public boolean requiresRestart() {
             return dependenciesLocations;
         }
     }
-    
+
     /**
      * {@inheritDoc}
      */
     @Override
     public Calendar getDateProperty(String name) {
+        Calendar result = null;
         try {
             // TODO: add timezone if not there?
             String p = getProperty(name);
-            return p == null
-                    ? null
-                    : ISO8601.parse(p);
+            if (p != null) {
+                result = ISO8601.parse(p);
+                if (result == null) {
+                    // Perhaps this is due to unusual timezone format +02 or +0200 that aren't supported by ISO8601.parse
+                    // but sometimes produced by maven plugins, compare https://issues.apache.org/jira/browse/JCRVLT-276
+                    Matcher splittedDate = TIMEZONE_FIX_PATTERN.matcher(p);

Review comment:
       Rather than fixing things here, why not use `GregorianCalendar.from(ZonedDateTime.parse(p, DateTimeFormatter.ISO_OFFSET_DATE_TIME))`? Whether you then still call `ISO8601.parse(p)` before or not is a matter of taste.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org