Github user mattyb149 commented on a diff in the pull request:
https://github.com/apache/nifi/pull/2180#discussion_r166080619
--- Diff:
nifi-nar-bundles/nifi-mongodb-bundle/nifi-mongodb-processors/src/main/java/org/apache/nifi/processors/mongodb/AbstractMongoProcessor.java
---
@@ -221,4 +264,16 @@ protected WriteConcern getWriteConcern(final
ProcessContext context) {
}
return writeConcern;
}
+
+ protected void writeBatch(String payload, FlowFile parent,
ProcessContext context, ProcessSession session, Map extraAttributes,
Relationship rel) throws UnsupportedEncodingException {
+ String charset = parent != null ?
context.getProperty(CHARSET).evaluateAttributeExpressions(parent).getValue()
+ :
context.getProperty(CHARSET).evaluateAttributeExpressions().getValue();
+
+ FlowFile flowFile = session.create(parent);
--- End diff --
The ternary operator for charset is fine, I'm referring to the
session.create(parent). If parent is null, then an NPE will be thrown when it
tries to get the parent's attributes.
---