CAMEL-8284: Moved copy to StreamCache

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

Branch: refs/heads/master
Commit: 8d713100b571adc7aa4940709e0edb3a6c3952f3
Parents: 72ed78d
Author: Claus Ibsen <davscl...@apache.org>
Authored: Sat Feb 21 10:56:41 2015 +0100
Committer: Claus Ibsen <davscl...@apache.org>
Committed: Sat Feb 21 10:56:41 2015 +0100

----------------------------------------------------------------------
 .../apache/camel/converter/stream/ByteArrayInputStreamCache.java | 2 +-
 .../org/apache/camel/converter/stream/StreamSourceCache.java     | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/8d713100/camel-core/src/main/java/org/apache/camel/converter/stream/ByteArrayInputStreamCache.java
----------------------------------------------------------------------
diff --git 
a/camel-core/src/main/java/org/apache/camel/converter/stream/ByteArrayInputStreamCache.java
 
b/camel-core/src/main/java/org/apache/camel/converter/stream/ByteArrayInputStreamCache.java
index 89d1c59..3b1dacf 100644
--- 
a/camel-core/src/main/java/org/apache/camel/converter/stream/ByteArrayInputStreamCache.java
+++ 
b/camel-core/src/main/java/org/apache/camel/converter/stream/ByteArrayInputStreamCache.java
@@ -54,7 +54,7 @@ public class ByteArrayInputStreamCache extends 
FilterInputStream implements Stre
     public StreamCache copy() throws IOException {
         if (byteArrayForCopy == null) {
             ByteArrayOutputStream baos = new 
ByteArrayOutputStream(in.available());
-            IOHelper.copy(this, baos);
+            IOHelper.copy(in, baos);
             // reset so that the stream can be reused
             reset();
             // cache the byte array, in order not to copy the byte array in 
the next call again

http://git-wip-us.apache.org/repos/asf/camel/blob/8d713100/camel-core/src/main/java/org/apache/camel/converter/stream/StreamSourceCache.java
----------------------------------------------------------------------
diff --git 
a/camel-core/src/main/java/org/apache/camel/converter/stream/StreamSourceCache.java
 
b/camel-core/src/main/java/org/apache/camel/converter/stream/StreamSourceCache.java
index 3367866..97edb29 100644
--- 
a/camel-core/src/main/java/org/apache/camel/converter/stream/StreamSourceCache.java
+++ 
b/camel-core/src/main/java/org/apache/camel/converter/stream/StreamSourceCache.java
@@ -84,10 +84,10 @@ public final class StreamSourceCache extends StreamSource 
implements StreamCache
 
     public StreamCache copy() throws IOException {
         if (streamCache != null) {
-            return new StreamSourceCache(streamCache).copy();
+            return new StreamSourceCache(streamCache.copy());
         }
         if (readCache != null) {
-            return new StreamSourceCache((ReaderCache) readCache.copy());
+            return new StreamSourceCache(readCache.copy());
         }
         return null;
     }

Reply via email to