mattyb149 commented on a change in pull request #3977: NIFI-7007 Add update
functionality to the PutCassandraRecord processor.
URL: https://github.com/apache/nifi/pull/3977#discussion_r374252991
##########
File path:
nifi-nar-bundles/nifi-cassandra-bundle/nifi-cassandra-processors/src/main/java/org/apache/nifi/processors/cassandra/PutCassandraRecord.java
##########
@@ -129,8 +210,39 @@ public void onTrigger(ProcessContext context,
ProcessSession session) throws Pro
final String cassandraTable =
context.getProperty(TABLE).evaluateAttributeExpressions(inputFlowFile).getValue();
final RecordReaderFactory recordParserFactory =
context.getProperty(RECORD_READER_FACTORY).asControllerService(RecordReaderFactory.class);
final int batchSize =
context.getProperty(BATCH_SIZE).evaluateAttributeExpressions().asInteger();
- final String batchStatementType =
context.getProperty(BATCH_STATEMENT_TYPE).getValue();
final String serialConsistencyLevel =
context.getProperty(CONSISTENCY_LEVEL).getValue();
+ final String updateKeys =
context.getProperty(UPDATE_KEYS).evaluateAttributeExpressions(inputFlowFile).getValue();
Review comment:
if the `Update Keys` property is not set, then `updateKeys` is `null`, not
an empty string as is set in the unit tests. This causes a NullPointerException
where the update keys are split from the property value. A null check should be
added, either to set the field to the empty string or to throw a different
exception than NPE. This can/should also be done in `customValidate`, which
illustrates the need for custom validation code (albeit duplicated at times).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services