Github user ijokarumawak commented on a diff in the pull request:
https://github.com/apache/nifi/pull/2400#discussion_r161126780
--- Diff:
nifi-nar-bundles/nifi-azure-bundle/nifi-azure-processors/src/main/java/org/apache/nifi/processors/azure/storage/utils/AzureStorageUtils.java
---
@@ -78,10 +84,15 @@ private AzureStorageUtils() {
// do not instantiate
}
- public static CloudBlobClient createCloudBlobClient(ProcessContext
context, ComponentLog logger) {
- final String accountName =
context.getProperty(AzureStorageUtils.ACCOUNT_NAME).evaluateAttributeExpressions().getValue();
- final String accountKey =
context.getProperty(AzureStorageUtils.ACCOUNT_KEY).evaluateAttributeExpressions().getValue();
- final String sasToken =
context.getProperty(AzureStorageUtils.PROP_SAS_TOKEN).evaluateAttributeExpressions().getValue();
+ /**
+ * Create CloudBlobClient instance.
+ * @param flowFile An incoming FlowFile can be used for NiFi
Expression Language evaluation to derive
+ * Account Name, Account Key or SAS Token. This can be
null if not available.
+ */
+ public static CloudBlobClient createCloudBlobClient(ProcessContext
context, ComponentLog logger, FlowFile flowFile) {
+ final String accountName =
context.getProperty(AzureStorageUtils.ACCOUNT_NAME).evaluateAttributeExpressions(flowFile).getValue();
+ final String accountKey =
context.getProperty(AzureStorageUtils.ACCOUNT_KEY).evaluateAttributeExpressions(flowFile).getValue();
+ final String sasToken =
context.getProperty(AzureStorageUtils.PROP_SAS_TOKEN).evaluateAttributeExpressions(flowFile).getValue();
--- End diff --
Thanks for the comment. Yes, I thought the exact same thing. But I did it
this way with a strong (a bit dangerous) knowledge that the standard
implementation of PropertyDescriptor handles null FlowFile reference. But yes,
if we check null here, it will be more defensive. I will update it.
---