abdera-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jmsn...@apache.org
Subject svn commit: r557495 - /incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/AtomDate.java
Date Thu, 19 Jul 2007 05:39:36 GMT
Author: jmsnell
Date: Wed Jul 18 22:39:35 2007
New Revision: 557495

URL: http://svn.apache.org/viewvc?view=rev&rev=557495
Log:
Was finally able to duplicate the date parsing bug (https://issues.apache.org/jira/browse/ABDERA-44)
This appears to fix it.

Modified:
    incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/AtomDate.java

Modified: incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/AtomDate.java
URL: http://svn.apache.org/viewvc/incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/AtomDate.java?view=diff&rev=557495&r1=557494&r2=557495
==============================================================================
--- incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/AtomDate.java (original)
+++ incubator/abdera/java/trunk/core/src/main/java/org/apache/abdera/model/AtomDate.java Wed
Jul 18 22:39:35 2007
@@ -220,6 +220,18 @@
    * @return The created java.util.Date
    */
   public static Date parse(String date) {
+    int ndx = date.indexOf('T');
+    if (ndx == -1) ndx = date.indexOf('t');
+    if (ndx > -1 && !date.endsWith("Z") && !date.endsWith("z")) {
+      int off = date.indexOf('+', ndx);
+      if (off == -1) off = date.indexOf('-', ndx);
+      if (off > -1) {
+        String s = date.substring(0,off);
+        String e = date.substring(off);
+        date = s + "GMT" + e;
+      }
+    }
+    
     Date d = null;
     SimpleDateFormat sdf = new SimpleDateFormat();
     for (int n = 0; n < masks.length; n++) {



Mime
View raw message