You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streams.apache.org by mf...@apache.org on 2014/06/23 20:22:33 UTC
[29/45] git commit: Fixed RFCUtils so all tests pass
Fixed RFCUtils so all tests pass
Project: http://git-wip-us.apache.org/repos/asf/incubator-streams/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-streams/commit/ad595b4e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-streams/tree/ad595b4e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-streams/diff/ad595b4e
Branch: refs/heads/master
Commit: ad595b4eecd6c90cc715eea8e40e0d25e17ab6f1
Parents: 906a68e
Author: rebanks <re...@w2odigital.com>
Authored: Mon Jun 16 15:30:56 2014 -0500
Committer: rebanks <re...@w2odigital.com>
Committed: Mon Jun 16 15:30:56 2014 -0500
----------------------------------------------------------------------
.../src/main/java/org/apache/streams/data/util/RFC3339Utils.java | 4 ++++
1 file changed, 4 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-streams/blob/ad595b4e/streams-pojo/src/main/java/org/apache/streams/data/util/RFC3339Utils.java
----------------------------------------------------------------------
diff --git a/streams-pojo/src/main/java/org/apache/streams/data/util/RFC3339Utils.java b/streams-pojo/src/main/java/org/apache/streams/data/util/RFC3339Utils.java
index 218b9ba..bd32668 100644
--- a/streams-pojo/src/main/java/org/apache/streams/data/util/RFC3339Utils.java
+++ b/streams-pojo/src/main/java/org/apache/streams/data/util/RFC3339Utils.java
@@ -44,6 +44,7 @@ public class RFC3339Utils {
private static final String SUB_SECOND = "\\.([0-9]*)";
private static final String UTC = "Z$";
+
private static final Pattern MILLIS = Pattern.compile("^[0-9]*$");
private static final Pattern UTC_STANDARD = Pattern.compile(BASE + UTC);
private static final Pattern UTC_SUB_SECOND = Pattern.compile(BASE + SUB_SECOND + UTC);
@@ -159,6 +160,9 @@ public class RFC3339Utils {
* @return {@link org.joda.time.DateTime} representation of the dateString
*/
public static DateTime parseToUTC(String dateString) {
+ if(MILLIS.matcher(dateString).find()) {
+ return new DateTime(Long.parseLong(dateString));
+ }
try {
return DEFAULT_FORMATTER.parseDateTime(dateString);
} catch (Exception e) {