camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [2/2] camel git commit: CAMEL-7882: camel-syslog timestamp header should be java.util.Date as it was before.
Date Sun, 30 Nov 2014 15:30:17 GMT
CAMEL-7882: camel-syslog timestamp header should be java.util.Date as it was before.


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

Branch: refs/heads/camel-2.14.x
Commit: 2d8148efbf75a9cacd123e64ffda222380dbf0cc
Parents: 539273b
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Sun Nov 30 16:29:44 2014 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Sun Nov 30 16:30:04 2014 +0100

----------------------------------------------------------------------
 .../org/apache/camel/component/syslog/SyslogDataFormat.java   | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/2d8148ef/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/SyslogDataFormat.java
----------------------------------------------------------------------
diff --git a/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/SyslogDataFormat.java
b/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/SyslogDataFormat.java
index cdc2146..399d8ab 100644
--- a/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/SyslogDataFormat.java
+++ b/components/camel-syslog/src/main/java/org/apache/camel/component/syslog/SyslogDataFormat.java
@@ -18,6 +18,7 @@ package org.apache.camel.component.syslog;
 
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.util.Date;
 
 import org.apache.camel.Exchange;
 import org.apache.camel.spi.DataFormat;
@@ -39,7 +40,11 @@ public class SyslogDataFormat implements DataFormat {
         exchange.getOut().setHeader(SyslogConstants.SYSLOG_FACILITY, message.getFacility());
         exchange.getOut().setHeader(SyslogConstants.SYSLOG_SEVERITY, message.getSeverity());
         exchange.getOut().setHeader(SyslogConstants.SYSLOG_HOSTNAME, message.getHostname());
-        exchange.getOut().setHeader(SyslogConstants.SYSLOG_TIMESTAMP, message.getTimestamp());
+        // use java.util.Date as timestamp
+        Date time = message.getTimestamp() != null ? message.getTimestamp().getTime() : null;
+        if (time != null) {
+            exchange.getOut().setHeader(SyslogConstants.SYSLOG_TIMESTAMP, time);
+        }
 
         // Since we are behind the fact of being in an Endpoint...
         // We need to pull in the remote/local via either Mina or Netty.


Mime
View raw message