[
https://issues.apache.org/jira/browse/CAMEL-15840?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Otavio Rodolfo Piske reassigned CAMEL-15840:
--------------------------------------------
Assignee: Otavio Rodolfo Piske
> camel-aws2-sns: duplicate copies of configuration objects lead to undefined
> behavior
> ------------------------------------------------------------------------------------
>
> Key: CAMEL-15840
> URL: https://issues.apache.org/jira/browse/CAMEL-15840
> Project: Camel
> Issue Type: Bug
> Components: camel-aws2
> Affects Versions: 3.4.4, 3.6.0
> Reporter: Otavio Rodolfo Piske
> Assignee: Otavio Rodolfo Piske
> Priority: Major
> Fix For: 3.4.5, 3.7.0
>
>
> Camel is keeping 2 different instances of the configuration object for the
> AWS 2 SNS component. Subsequently, changes to the object instances cause both
> of them to be out of sync leading to undefined behavior depending on each
> copy is read.
> The problem flow is:
> # A copy of the configuration object if created when instantiating the
> endpoint:
> [https://github.com/apache/camel/blob/46945de816123cc894846a7e5cfe145f39e76f95/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Component.java#L57|https://github.com/apache/camel/blob/master/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Component.java#L57]
> # The copy object is then set with additional configuration values, such as
> the topic and topicArn:
> [https://github.com/apache/camel/blob/46945de816123cc894846a7e5cfe145f39e76f95/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Component.java#L63-L66|https://github.com/apache/camel/blob/master/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Component.java#L63-L66]
> # Then, when trying to set the component properties, the configuration
> object will be overwritten and the changes on step 2 may be lost:
> [https://github.com/apache/camel/blob/46945de816123cc894846a7e5cfe145f39e76f95/components/camel-aws2-sns/src/main/java/org/apache/camel/component/aws2/sns/Sns2Component.java#L69]
>
> Under some circumstances, such as when using a custom configuration object
> this causes the code to overwrite the object.
> Here's a code snippet of the debug of the content of the parameters Map, used
> by setProperties to setup the endpoint. The introspection will eventually
> overwrite the configuration object.
>
> {code:java}
> 2020-11-10 13:52:33,853 [nectorWithUrl-0] DEBUG
> org.apache.camel.component.aws2.sns.Sns2Component - Parameters -- Key:
> accessKey, Value: accesskey
> 2020-11-10 13:52:33,853 [nectorWithUrl-0] DEBUG
> org.apache.camel.component.aws2.sns.Sns2Component - Parameters -- Key:
> configuration, Value:
> #class:org.apache.camel.kafkaconnector.aws.v2.sns.sink.TestSnsConfiguration
> 2020-11-10 13:52:33,853 [nectorWithUrl-0] DEBUG
> org.apache.camel.component.aws2.sns.Sns2Component - Parameters -- Key:
> queueUrl, Value: http://localhost:35886/000000000000/ckcsns-608
> 2020-11-10 13:52:33,853 [nectorWithUrl-0] DEBUG
> org.apache.camel.component.aws2.sns.Sns2Component - Parameters -- Key:
> region, Value: us-east-1
> 2020-11-10 13:52:33,853 [nectorWithUrl-0] DEBUG
> org.apache.camel.component.aws2.sns.Sns2Component - Parameters -- Key:
> secretKey, Value: secretkey
> 2020-11-10 13:52:33,853 [nectorWithUrl-0] DEBUG
> org.apache.camel.component.aws2.sns.Sns2Component - Parameters -- Key:
> subscribeSNStoSQS, Value: true
> {code}
>
>
>
>
>
>
>
>
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)