diff --git a/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/credentials/provider/service/AWSCredentialsProviderControllerService.java b/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/credentials/provider/service/AWSCredentialsProviderControllerService.java index fcb9dc7aa0..1323f9c1cf 100644 --- a/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/credentials/provider/service/AWSCredentialsProviderControllerService.java +++ b/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/credentials/provider/service/AWSCredentialsProviderControllerService.java @@ -19,6 +19,7 @@ package org.apache.nifi.processors.aws.credentials.provider.service; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -33,7 +34,6 @@ import org.apache.nifi.controller.ConfigurationContext; import org.apache.nifi.processor.exception.ProcessException; import org.apache.nifi.processors.aws.credentials.provider.factory.CredentialPropertyDescriptors; import org.apache.nifi.processors.aws.credentials.provider.factory.CredentialsProviderFactory; -import org.apache.nifi.reporting.InitializationException; import com.amazonaws.auth.AWSCredentialsProvider; @@ -99,21 +99,19 @@ public class AWSCredentialsProviderControllerService extends AbstractControllerS @Override protected Collection customValidate(final ValidationContext validationContext) { - final Collection validationFailureResults = - credentialsProviderFactory.validate(validationContext); - return validationFailureResults; + return credentialsProviderFactory.validate(validationContext); } @OnEnabled - public void onConfigured(final ConfigurationContext context) throws InitializationException { - final Map properties = context.getProperties(); - properties.keySet().forEach(propertyDescriptor -> { + public void onConfigured(final ConfigurationContext context) { + final Map evaluatedProperties = new HashMap<>(context.getProperties()); + evaluatedProperties.keySet().forEach(propertyDescriptor -> { if (propertyDescriptor.isExpressionLanguageSupported()) { - properties.put(propertyDescriptor, + evaluatedProperties.put(propertyDescriptor, context.getProperty(propertyDescriptor).evaluateAttributeExpressions().getValue()); } }); - credentialsProvider = credentialsProviderFactory.getCredentialsProvider(properties); + credentialsProvider = credentialsProviderFactory.getCredentialsProvider(evaluatedProperties); getLogger().debug("Using credentials provider: " + credentialsProvider.getClass()); }