manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1489044 - in /manifoldcf/trunk: CHANGES.txt framework/core/src/main/java/org/apache/manifoldcf/core/common/DateParser.java
Date Mon, 03 Jun 2013 16:02:35 GMT
Author: kwright
Date: Mon Jun  3 16:02:35 2013
New Revision: 1489044

URL: http://svn.apache.org/r1489044
Log:
Fix for CONNECTORS-700.

Modified:
    manifoldcf/trunk/CHANGES.txt
    manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/common/DateParser.java

Modified: manifoldcf/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/CHANGES.txt?rev=1489044&r1=1489043&r2=1489044&view=diff
==============================================================================
--- manifoldcf/trunk/CHANGES.txt (original)
+++ manifoldcf/trunk/CHANGES.txt Mon Jun  3 16:02:35 2013
@@ -3,6 +3,10 @@ $Id$
 
 ======================= 1.3-dev =====================
 
+CONNECTORS-700: Fix ISO8601 date parsing to handle timezones with
+colons in them, e.g. -08:00
+(Stephane Gamard, Karl Wright)
+
 CONNECTORS-698: Add various required metadata values to the
 GoogleDrive connector.
 (Karl Wright)

Modified: manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/common/DateParser.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/common/DateParser.java?rev=1489044&r1=1489043&r2=1489044&view=diff
==============================================================================
--- manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/common/DateParser.java
(original)
+++ manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/common/DateParser.java
Mon Jun  3 16:02:35 2013
@@ -43,7 +43,17 @@ public class DateParser
     if (isoDateValue.endsWith("Z"))
       isoFormatString.append("'Z'");
     else
+    {
+      // We need to be able to parse either "-08:00" or "-0800".  The 'Z' specifier only
handles
+      // -0800, unfortunately - see CONNECTORS-700.  So we have to do some hackery to remove
the colon.
+      int colonIndex = isoDateValue.lastIndexOf(":");
+      int dashIndex = isoDateValue.lastIndexOf("-");
+      int plusIndex = isoDateValue.lastIndexOf("+");
+      if (colonIndex != -1 &&
+        ((dashIndex != -1 && colonIndex == dashIndex+3) || (plusIndex != -1 &&
colonIndex == plusIndex+3)))
+        isoDateValue = isoDateValue.substring(0,colonIndex) + isoDateValue.substring(colonIndex+1);
       isoFormatString.append("Z");      // RFC 822 time, including general time zones
+    }
     java.text.DateFormat iso8601Format = new java.text.SimpleDateFormat(isoFormatString.toString());
     try
     {



Mime
View raw message