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 90fb3e150da0c014758d200552d6e81c2696fa00 Author: Andrea Cosentino <anco...@gmail.com> AuthorDate: Tue Mar 30 17:00:47 2021 +0200 Fixed CS --- .../component/aws2/lambda/Lambda2Producer.java | 42 +++++++++++----------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Producer.java b/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Producer.java index ff83523..58edc7d 100644 --- a/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Producer.java +++ b/components/camel-aws/camel-aws2-lambda/src/main/java/org/apache/camel/component/aws2/lambda/Lambda2Producer.java @@ -406,30 +406,30 @@ public class Lambda2Producer extends DefaultProducer { private void createEventSourceMapping(LambdaClient lambdaClient, Exchange exchange) throws InvalidPayloadException { CreateEventSourceMappingRequest request = null; CreateEventSourceMappingResponse result; - if (getConfiguration().isPojoRequest()) { + if (getConfiguration().isPojoRequest()) { request = exchange.getIn().getMandatoryBody(CreateEventSourceMappingRequest.class); } else { - CreateEventSourceMappingRequest.Builder builder = CreateEventSourceMappingRequest.builder(); - builder.functionName(getEndpoint().getFunction()); - if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(Lambda2Constants.EVENT_SOURCE_ARN))) { - builder.eventSourceArn(exchange.getIn().getHeader(Lambda2Constants.EVENT_SOURCE_ARN, String.class)); - } else { - throw new IllegalArgumentException("Event Source Arn must be specified"); - } - if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(Lambda2Constants.EVENT_SOURCE_BATCH_SIZE))) { - Integer batchSize = exchange.getIn().getHeader(Lambda2Constants.EVENT_SOURCE_BATCH_SIZE, Integer.class); - builder.batchSize(batchSize); - } - request = builder.build(); - } - try { - result = lambdaClient.createEventSourceMapping(request); - } catch (AwsServiceException ase) { - LOG.trace("createEventSourceMapping command returned the error code {}", ase.awsErrorDetails().errorCode()); - throw ase; + CreateEventSourceMappingRequest.Builder builder = CreateEventSourceMappingRequest.builder(); + builder.functionName(getEndpoint().getFunction()); + if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(Lambda2Constants.EVENT_SOURCE_ARN))) { + builder.eventSourceArn(exchange.getIn().getHeader(Lambda2Constants.EVENT_SOURCE_ARN, String.class)); + } else { + throw new IllegalArgumentException("Event Source Arn must be specified"); } - Message message = getMessageForResponse(exchange); - message.setBody(result); + if (ObjectHelper.isNotEmpty(exchange.getIn().getHeader(Lambda2Constants.EVENT_SOURCE_BATCH_SIZE))) { + Integer batchSize = exchange.getIn().getHeader(Lambda2Constants.EVENT_SOURCE_BATCH_SIZE, Integer.class); + builder.batchSize(batchSize); + } + request = builder.build(); + } + try { + result = lambdaClient.createEventSourceMapping(request); + } catch (AwsServiceException ase) { + LOG.trace("createEventSourceMapping command returned the error code {}", ase.awsErrorDetails().errorCode()); + throw ase; + } + Message message = getMessageForResponse(exchange); + message.setBody(result); } private void deleteEventSourceMapping(LambdaClient lambdaClient, Exchange exchange) throws InvalidPayloadException {