camel-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From davscl...@apache.org
Subject [2/2] git commit: CAMEL-7005: Fixed regression in camel-stream when reading from system in.
Date Sun, 24 Nov 2013 11:34:04 GMT
CAMEL-7005: Fixed regression in camel-stream when reading from system in.


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

Branch: refs/heads/camel-2.11.x
Commit: 35e97008a289e0959baa5eb5a46a5691bc1fcde7
Parents: 22ada8a
Author: Claus Ibsen <davsclaus@apache.org>
Authored: Sun Nov 24 12:35:17 2013 +0100
Committer: Claus Ibsen <davsclaus@apache.org>
Committed: Sun Nov 24 12:35:47 2013 +0100

----------------------------------------------------------------------
 .../apache/camel/component/stream/StreamConsumer.java    | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/35e97008/components/camel-stream/src/main/java/org/apache/camel/component/stream/StreamConsumer.java
----------------------------------------------------------------------
diff --git a/components/camel-stream/src/main/java/org/apache/camel/component/stream/StreamConsumer.java
b/components/camel-stream/src/main/java/org/apache/camel/component/stream/StreamConsumer.java
index c1c8b83..45c2d14 100644
--- a/components/camel-stream/src/main/java/org/apache/camel/component/stream/StreamConsumer.java
+++ b/components/camel-stream/src/main/java/org/apache/camel/component/stream/StreamConsumer.java
@@ -162,7 +162,7 @@ public class StreamConsumer extends DefaultConsumer implements Runnable
{
                 eos = line == null;
                 if (!eos && isRunAllowed()) {
                     // read ahead if there is more data
-                    line2 = br.readLine();
+                    line2 = readAhead(br);
                     boolean last = line2 == null;
                     index = processLine(line, last, index);
                 }
@@ -231,6 +231,15 @@ public class StreamConsumer extends DefaultConsumer implements Runnable
{
         }
     }
 
+    private String readAhead(BufferedReader br) throws IOException {
+        if (uri.equals("in")) {
+            // do not read ahead with reading from system in
+            return null;
+        } else {
+            return br.readLine();
+        }
+    }
+
     private InputStream resolveStreamFromUrl() throws IOException {
         String u = endpoint.getUrl();
         ObjectHelper.notEmpty(u, "url");


Mime
View raw message