Fix AWSCredentialsService EL attribute evaluation.
@@ -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<ValidationResult> customValidate(final ValidationContext validationContext) {
- final Collection<ValidationResult> validationFailureResults =
- credentialsProviderFactory.validate(validationContext);
- return validationFailureResults;
+ return credentialsProviderFactory.validate(validationContext);
}
@OnEnabled
- public void onConfigured(final ConfigurationContext context) throws InitializationException {
- final Map<PropertyDescriptor, String> properties = context.getProperties();
- properties.keySet().forEach(propertyDescriptor -> {
+ public void onConfigured(final ConfigurationContext context) {
+ final Map<PropertyDescriptor, String> 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());
}
