flume-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From roshann...@apache.org
Subject flume git commit: FLUME-2889. Fixes to DateTime computations
Date Fri, 26 Feb 2016 01:35:09 GMT
Repository: flume
Updated Branches:
  refs/heads/flume-1.7 44bbe97d9 -> fe24607f4


FLUME-2889. Fixes to DateTime computations

(Roshan Naik via Hari Shreedharan)


Project: http://git-wip-us.apache.org/repos/asf/flume/repo
Commit: http://git-wip-us.apache.org/repos/asf/flume/commit/fe24607f
Tree: http://git-wip-us.apache.org/repos/asf/flume/tree/fe24607f
Diff: http://git-wip-us.apache.org/repos/asf/flume/diff/fe24607f

Branch: refs/heads/flume-1.7
Commit: fe24607f42e2684128fbacdd73fa7489966aecc5
Parents: 44bbe97
Author: Roshan Naik <roshan@hortonworks.com>
Authored: Thu Feb 25 17:31:24 2016 -0800
Committer: Roshan Naik <roshan@hortonworks.com>
Committed: Thu Feb 25 17:32:01 2016 -0800

----------------------------------------------------------------------
 .../src/main/java/org/apache/flume/source/SyslogParser.java      | 4 ++--
 .../apache/flume/serialization/SyslogAvroEventSerializer.java    | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flume/blob/fe24607f/flume-ng-core/src/main/java/org/apache/flume/source/SyslogParser.java
----------------------------------------------------------------------
diff --git a/flume-ng-core/src/main/java/org/apache/flume/source/SyslogParser.java b/flume-ng-core/src/main/java/org/apache/flume/source/SyslogParser.java
index b61f745..c8245ff 100644
--- a/flume-ng-core/src/main/java/org/apache/flume/source/SyslogParser.java
+++ b/flume-ng-core/src/main/java/org/apache/flume/source/SyslogParser.java
@@ -325,10 +325,10 @@ public class SyslogParser {
 
       // flume clock is ahead or there is some latency, and the year rolled
       if (fixed.isAfter(now) && fixed.minusMonths(1).isAfter(now)) {
-        fixed = date.withYear(year - 1);
+         fixed = date.minusYears(1);
       // flume clock is behind and the year rolled
       } else if (fixed.isBefore(now) && fixed.plusMonths(1).isBefore(now)) {
-        fixed = date.withYear(year + 1);
+        fixed = date.plusYears(1);
       }
       date = fixed;
     }

http://git-wip-us.apache.org/repos/asf/flume/blob/fe24607f/flume-ng-core/src/test/java/org/apache/flume/serialization/SyslogAvroEventSerializer.java
----------------------------------------------------------------------
diff --git a/flume-ng-core/src/test/java/org/apache/flume/serialization/SyslogAvroEventSerializer.java
b/flume-ng-core/src/test/java/org/apache/flume/serialization/SyslogAvroEventSerializer.java
index d1cbcae..896eced 100644
--- a/flume-ng-core/src/test/java/org/apache/flume/serialization/SyslogAvroEventSerializer.java
+++ b/flume-ng-core/src/test/java/org/apache/flume/serialization/SyslogAvroEventSerializer.java
@@ -190,10 +190,10 @@ public class SyslogAvroEventSerializer
 
       // flume clock is ahead or there is some latency, and the year rolled
       if (corrected.isAfter(now) && corrected.minusMonths(1).isAfter(now)) {
-        corrected = date.withYear(year - 1);
+        corrected = date.minusYears(1);
       // flume clock is behind and the year rolled
       } else if (corrected.isBefore(now) && corrected.plusMonths(1).isBefore(now))
{
-        corrected = date.withYear(year + 1);
+        corrected = date.plusYears(1);
       }
       date = corrected;
     }


Mime
View raw message