You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by ac...@apache.org on 2020/04/10 08:43:19 UTC

[camel] branch master updated (3f9d5e7 -> 73bf60d)

This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git.


    from 3f9d5e7  CAMEL-14864: Generte ExtendedCamelContextConfigurer in impl package so its not in root package which should be exposed only by camel-api; otherwise we have OSGi problems.
     new 61d72c6  CAMEL-14868 - Camel-AWS2-*: Where possible, give the possiblity to the end user to pass an AWS Request pojo as body, aws2-translate use mandatory body
     new 73bf60d  CAMEL-14868 - Camel-AWS2-*: Where possible, give the possiblity to the end user to pass an AWS Request pojo as body, aws2-translate fixed CS

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../aws2/translate/Translate2Producer.java         | 25 +++++++++++-----------
 1 file changed, 12 insertions(+), 13 deletions(-)


[camel] 01/02: CAMEL-14868 - Camel-AWS2-*: Where possible, give the possiblity to the end user to pass an AWS Request pojo as body, aws2-translate use mandatory body

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 61d72c6a19efe8d3093be652e3e28a5bd1c03113
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Fri Apr 10 10:39:23 2020 +0200

    CAMEL-14868 - Camel-AWS2-*: Where possible, give the possiblity to the end user to pass an AWS Request pojo as body, aws2-translate use mandatory body
---
 .../camel/component/aws2/translate/Translate2Producer.java       | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/components/camel-aws2-translate/src/main/java/org/apache/camel/component/aws2/translate/Translate2Producer.java b/components/camel-aws2-translate/src/main/java/org/apache/camel/component/aws2/translate/Translate2Producer.java
index ef4ec84..bd6eaf53 100644
--- a/components/camel-aws2-translate/src/main/java/org/apache/camel/component/aws2/translate/Translate2Producer.java
+++ b/components/camel-aws2-translate/src/main/java/org/apache/camel/component/aws2/translate/Translate2Producer.java
@@ -20,6 +20,7 @@ import java.util.Collection;
 
 import org.apache.camel.Endpoint;
 import org.apache.camel.Exchange;
+import org.apache.camel.InvalidPayloadException;
 import org.apache.camel.Message;
 import org.apache.camel.support.DefaultProducer;
 import org.apache.camel.util.ObjectHelper;
@@ -81,11 +82,10 @@ public class Translate2Producer extends DefaultProducer {
         return (Translate2Endpoint)super.getEndpoint();
     }
 
-    private void translateText(TranslateClient translateClient, Exchange exchange) {
+    private void translateText(TranslateClient translateClient, Exchange exchange) throws InvalidPayloadException {
         if (getConfiguration().isPojoRequest()) {
-            if (ObjectHelper.isNotEmpty(exchange.getIn().getBody())) {
-                if (exchange.getIn().getBody() instanceof TranslateTextRequest) {
-                    Object payload = exchange.getIn().getBody();
+        	Object payload = exchange.getIn().getMandatoryBody();
+                if (payload instanceof TranslateTextRequest) {
                     TranslateTextResponse result;
                     try {
                         result = translateClient.translateText((TranslateTextRequest)payload);
@@ -95,7 +95,6 @@ public class Translate2Producer extends DefaultProducer {
                     }
                     Message message = getMessageForResponse(exchange);
                     message.setBody(result.translatedText());
-                }
             }
         } else {
             Builder request = TranslateTextRequest.builder();


[camel] 02/02: CAMEL-14868 - Camel-AWS2-*: Where possible, give the possiblity to the end user to pass an AWS Request pojo as body, aws2-translate fixed CS

Posted by ac...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

acosentino pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/camel.git

commit 73bf60deae3e1b2baee0cad42cf70d82fc2b8792
Author: Andrea Cosentino <an...@gmail.com>
AuthorDate: Fri Apr 10 10:41:21 2020 +0200

    CAMEL-14868 - Camel-AWS2-*: Where possible, give the possiblity to the end user to pass an AWS Request pojo as body, aws2-translate fixed CS
---
 .../aws2/translate/Translate2Producer.java         | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/components/camel-aws2-translate/src/main/java/org/apache/camel/component/aws2/translate/Translate2Producer.java b/components/camel-aws2-translate/src/main/java/org/apache/camel/component/aws2/translate/Translate2Producer.java
index bd6eaf53..ea44976 100644
--- a/components/camel-aws2-translate/src/main/java/org/apache/camel/component/aws2/translate/Translate2Producer.java
+++ b/components/camel-aws2-translate/src/main/java/org/apache/camel/component/aws2/translate/Translate2Producer.java
@@ -84,17 +84,17 @@ public class Translate2Producer extends DefaultProducer {
 
     private void translateText(TranslateClient translateClient, Exchange exchange) throws InvalidPayloadException {
         if (getConfiguration().isPojoRequest()) {
-        	Object payload = exchange.getIn().getMandatoryBody();
-                if (payload instanceof TranslateTextRequest) {
-                    TranslateTextResponse result;
-                    try {
-                        result = translateClient.translateText((TranslateTextRequest)payload);
-                    } catch (AwsServiceException ase) {
-                        LOG.trace("Translate Text command returned the error code {}", ase.awsErrorDetails().errorCode());
-                        throw ase;
-                    }
-                    Message message = getMessageForResponse(exchange);
-                    message.setBody(result.translatedText());
+            Object payload = exchange.getIn().getMandatoryBody();
+            if (payload instanceof TranslateTextRequest) {
+                TranslateTextResponse result;
+                try {
+                    result = translateClient.translateText((TranslateTextRequest)payload);
+                } catch (AwsServiceException ase) {
+                    LOG.trace("Translate Text command returned the error code {}", ase.awsErrorDetails().errorCode());
+                    throw ase;
+                }
+                Message message = getMessageForResponse(exchange);
+                message.setBody(result.translatedText());
             }
         } else {
             Builder request = TranslateTextRequest.builder();