esme-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vdic...@apache.org
Subject svn commit: r1031968 - in /incubator/esme/trunk/server/src/main/scala/org/apache/esme/external: AtomFeed.scala Feed.scala RssFeed.scala
Date Sat, 06 Nov 2010 08:11:10 GMT
Author: vdichev
Date: Sat Nov  6 08:11:10 2010
New Revision: 1031968

URL: http://svn.apache.org/viewvc?rev=1031968&view=rev
Log:
ESME-275 Fix exception on parsing feed with improperly formatted Internet date

Modified:
    incubator/esme/trunk/server/src/main/scala/org/apache/esme/external/AtomFeed.scala
    incubator/esme/trunk/server/src/main/scala/org/apache/esme/external/Feed.scala
    incubator/esme/trunk/server/src/main/scala/org/apache/esme/external/RssFeed.scala

Modified: incubator/esme/trunk/server/src/main/scala/org/apache/esme/external/AtomFeed.scala
URL: http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/main/scala/org/apache/esme/external/AtomFeed.scala?rev=1031968&r1=1031967&r2=1031968&view=diff
==============================================================================
--- incubator/esme/trunk/server/src/main/scala/org/apache/esme/external/AtomFeed.scala (original)
+++ incubator/esme/trunk/server/src/main/scala/org/apache/esme/external/AtomFeed.scala Sat
Nov  6 08:11:10 2010
@@ -63,7 +63,7 @@ class AtomFeed(user: User, atomURL: Stri
     val date = if (published isEmpty)
       node \ "updated"
       else published
-    parseInternetDate(date text).getTime
+    parseInternetDate(date text).map(_.getTime).getOrElse(System.currentTimeMillis)
   }
 }
 

Modified: incubator/esme/trunk/server/src/main/scala/org/apache/esme/external/Feed.scala
URL: http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/main/scala/org/apache/esme/external/Feed.scala?rev=1031968&r1=1031967&r2=1031968&view=diff
==============================================================================
--- incubator/esme/trunk/server/src/main/scala/org/apache/esme/external/Feed.scala (original)
+++ incubator/esme/trunk/server/src/main/scala/org/apache/esme/external/Feed.scala Sat Nov
 6 08:11:10 2010
@@ -80,11 +80,11 @@ abstract class Feed(val user: User, val 
     }
   }
   
-  protected def parseInternetDate(dateString: String): Date = {
+  protected def parseInternetDate(dateString: String): Option[Date] = {
     val fixedDateString = fixDateString(dateString)
     dateFormats.projection.flatMap(df => Helpers.tryo {
       df.parse(fixedDateString)
-    }).head
+    }).headOption
   }
   
   protected def fixDateString(dateString: String) = {

Modified: incubator/esme/trunk/server/src/main/scala/org/apache/esme/external/RssFeed.scala
URL: http://svn.apache.org/viewvc/incubator/esme/trunk/server/src/main/scala/org/apache/esme/external/RssFeed.scala?rev=1031968&r1=1031967&r2=1031968&view=diff
==============================================================================
--- incubator/esme/trunk/server/src/main/scala/org/apache/esme/external/RssFeed.scala (original)
+++ incubator/esme/trunk/server/src/main/scala/org/apache/esme/external/RssFeed.scala Sat
Nov  6 08:11:10 2010
@@ -64,7 +64,7 @@ class RssFeed(user: User, rssURL: String
     if (date isEmpty)
       System.currentTimeMillis
     else
-      parseInternetDate(date text).getTime
+      parseInternetDate(date text).map(_.getTime).getOrElse(System.currentTimeMillis)
   }
   
   // need to compare by text since a pubDate is not mandatory and indeed, often is missing



Mime
View raw message