manifoldcf-commits mailing list archives

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

URL: http://svn.apache.org/r1489058
Log:
Fix CONNECTORS-700 -related regression

Modified:
    manifoldcf/trunk/framework/core/src/main/java/org/apache/manifoldcf/core/common/DateParser.java
    manifoldcf/trunk/framework/core/src/test/java/org/apache/manifoldcf/core/common/DateTest.java

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=1489058&r1=1489057&r2=1489058&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:43:35 2013
@@ -50,7 +50,7 @@ public class DateParser
       int dashIndex = isoDateValue.lastIndexOf("-");
       int plusIndex = isoDateValue.lastIndexOf("+");
       if (colonIndex != -1 &&
-        ((dashIndex != -1 && colonIndex == dashIndex+3) || (plusIndex != -1 &&
colonIndex == plusIndex+3)))
+        ((dashIndex != -1 && colonIndex == dashIndex+3 && isNumeral(isoDateValue,dashIndex-1))
|| (plusIndex != -1 && colonIndex == plusIndex+3 && isNumeral(isoDateValue,plusIndex-1))))
         isoDateValue = isoDateValue.substring(0,colonIndex) + isoDateValue.substring(colonIndex+1);
       isoFormatString.append("Z");      // RFC 822 time, including general time zones
     }
@@ -65,6 +65,11 @@ public class DateParser
     }
   }
   
+  protected static boolean isNumeral(String value, int index)
+  {
+    return index >= 0 && value.charAt(index) >= '0' && value.charAt(index)
<= '9';
+  }
+  
   /** Format ISO8601 date.
   */
   public static String formatISO8601Date(Date dateValue)

Modified: manifoldcf/trunk/framework/core/src/test/java/org/apache/manifoldcf/core/common/DateTest.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/core/src/test/java/org/apache/manifoldcf/core/common/DateTest.java?rev=1489058&r1=1489057&r2=1489058&view=diff
==============================================================================
--- manifoldcf/trunk/framework/core/src/test/java/org/apache/manifoldcf/core/common/DateTest.java
(original)
+++ manifoldcf/trunk/framework/core/src/test/java/org/apache/manifoldcf/core/common/DateTest.java
Mon Jun  3 16:43:35 2013
@@ -39,6 +39,8 @@ public class DateTest
     assertNotNull(d);
     d = DateParser.parseISO8601Date("2012-11-15T01:32:33-03:00");
     assertNotNull(d);
+    d = DateParser.parseISO8601Date("2012-11-15T01:32:33GMT-03:00");
+    assertNotNull(d);
     d = DateParser.parseISO8601Date("2012-11-15T01:32:33.001-04:00");
     assertNotNull(d);
   }



Mime
View raw message