You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ni...@apache.org on 2014/11/07 08:31:19 UTC
camel git commit: CAMEL-8006 Polished the code with suggestion of
Claus
Repository: camel
Updated Branches:
refs/heads/master ff87129bf -> 9ef01070d
CAMEL-8006 Polished the code with suggestion of Claus
Project: http://git-wip-us.apache.org/repos/asf/camel/repo
Commit: http://git-wip-us.apache.org/repos/asf/camel/commit/9ef01070
Tree: http://git-wip-us.apache.org/repos/asf/camel/tree/9ef01070
Diff: http://git-wip-us.apache.org/repos/asf/camel/diff/9ef01070
Branch: refs/heads/master
Commit: 9ef01070d6a1b2d42f8d9a5c71e7bfd61be716a5
Parents: ff87129
Author: Willem Jiang <wi...@gmail.com>
Authored: Fri Nov 7 15:26:05 2014 +0800
Committer: Willem Jiang <wi...@gmail.com>
Committed: Fri Nov 7 15:26:05 2014 +0800
----------------------------------------------------------------------
.../org/apache/camel/component/aws/s3/S3Producer.java | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/camel/blob/9ef01070/components/camel-aws/src/main/java/org/apache/camel/component/aws/s3/S3Producer.java
----------------------------------------------------------------------
diff --git a/components/camel-aws/src/main/java/org/apache/camel/component/aws/s3/S3Producer.java b/components/camel-aws/src/main/java/org/apache/camel/component/aws/s3/S3Producer.java
index 4d6f3ae..95af397 100644
--- a/components/camel-aws/src/main/java/org/apache/camel/component/aws/s3/S3Producer.java
+++ b/components/camel-aws/src/main/java/org/apache/camel/component/aws/s3/S3Producer.java
@@ -37,10 +37,10 @@ import com.amazonaws.services.s3.model.PutObjectRequest;
import com.amazonaws.services.s3.model.PutObjectResult;
import com.amazonaws.services.s3.model.StorageClass;
import com.amazonaws.services.s3.model.UploadPartRequest;
-
import org.apache.camel.Endpoint;
import org.apache.camel.Exchange;
import org.apache.camel.Message;
+import org.apache.camel.WrappedFile;
import org.apache.camel.impl.DefaultProducer;
import org.apache.camel.util.CastUtils;
import org.apache.camel.util.FileUtil;
@@ -75,7 +75,11 @@ public class S3Producer extends DefaultProducer {
public void processMultiPart(final Exchange exchange) throws Exception {
File filePayload = null;
- final Object obj = exchange.getIn().getMandatoryBody();
+ Object obj = exchange.getIn().getMandatoryBody();
+ // Need to check if the message body is WrappedFile
+ if (obj instanceof WrappedFile) {
+ obj = ((WrappedFile<?>)obj).getFile();
+ }
if (obj instanceof File) {
filePayload = (File) obj;
} else {
@@ -168,9 +172,12 @@ public class S3Producer extends DefaultProducer {
File filePayload = null;
Object obj = exchange.getIn().getMandatoryBody();
PutObjectRequest putObjectRequest = null;
+ // Need to check if the message body is WrappedFile
+ if (obj instanceof WrappedFile) {
+ obj = ((WrappedFile<?>)obj).getFile();
+ }
if (obj instanceof File) {
filePayload = (File) obj;
- // submit the request without loading it into memory
putObjectRequest = new PutObjectRequest(getConfiguration().getBucketName(), determineKey(exchange), filePayload);
} else {
putObjectRequest = new PutObjectRequest(getConfiguration().getBucketName(),