You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2014/03/28 13:40:11 UTC

[2/2] git commit: CAMEL-7312: File -> Serializable should covert to byte[] first to use a reliable convertion pattern.

CAMEL-7312: File -> Serializable should covert to byte[] first to use a reliable convertion pattern.


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

Branch: refs/heads/camel-2.13.x
Commit: 6e063c2f61e42df0cd4faecbd78bb8c3d6787ee2
Parents: da30a0d
Author: Claus Ibsen <da...@apache.org>
Authored: Fri Mar 28 13:42:28 2014 +0100
Committer: Claus Ibsen <da...@apache.org>
Committed: Fri Mar 28 13:43:22 2014 +0100

----------------------------------------------------------------------
 .../org/apache/camel/component/file/GenericFileConverter.java  | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/camel/blob/6e063c2f/camel-core/src/main/java/org/apache/camel/component/file/GenericFileConverter.java
----------------------------------------------------------------------
diff --git a/camel-core/src/main/java/org/apache/camel/component/file/GenericFileConverter.java b/camel-core/src/main/java/org/apache/camel/component/file/GenericFileConverter.java
index aaed06f..4dce79a 100644
--- a/camel-core/src/main/java/org/apache/camel/component/file/GenericFileConverter.java
+++ b/camel-core/src/main/java/org/apache/camel/component/file/GenericFileConverter.java
@@ -151,7 +151,11 @@ public final class GenericFileConverter {
             // load the file using input stream
             InputStream is = genericFileToInputStream(file, exchange);
             if (is != null) {
-                return exchange.getContext().getTypeConverter().convertTo(Serializable.class, exchange, is);
+                // need to double convert to convert correctly
+                byte[] data = exchange.getContext().getTypeConverter().convertTo(byte[].class, exchange, is);
+                if (data != null) {
+                    return exchange.getContext().getTypeConverter().convertTo(Serializable.class, exchange, data);
+                }
             }
         }
         // should revert to fallback converter if we don't have an exchange