[ 
https://issues.apache.org/jira/browse/NIFI-13564?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Mark Payne updated NIFI-13564:
------------------------------
    Description: 
PutDatabaseRecord's initialization has the following logic:
{code:java}
final String statementTypeRecordPathValue = 
context.getProperty(STATEMENT_TYPE_RECORD_PATH).getValue();
if (statementTypeRecordPathValue == null) {
    recordPathOperationType = null;
} else {
    final RecordPath recordPath = 
RecordPath.compile(statementTypeRecordPathValue);
    recordPathOperationType = new RecordPathStatementType(recordPath);
} {code}
This assumes that the RecordPath is valid or is not set. But that's necessarily 
the case. Because the STATEMENT_TYPE_RECORD_PATH property depends on the 
"Statement Type" property being set to "RecordPath", it is possible to set the 
Statement Type to RecordPath, set an invalid RecordPath, and then change the 
Statement Type to something else, such as INSERT.

Now, the Processor fails to start, with a cryptic error message.

The Processor needs to be updated to ensure that it does not attempt to compile 
the RecordPath unless the "Statement Type" property is set to "RecordPath".

> PutDatabaseRecord throws RecordPathException even when RecordPath is not set
> ----------------------------------------------------------------------------
>
>                 Key: NIFI-13564
>                 URL: https://issues.apache.org/jira/browse/NIFI-13564
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Extensions
>            Reporter: Mark Payne
>            Priority: Major
>
> PutDatabaseRecord's initialization has the following logic:
> {code:java}
> final String statementTypeRecordPathValue = 
> context.getProperty(STATEMENT_TYPE_RECORD_PATH).getValue();
> if (statementTypeRecordPathValue == null) {
>     recordPathOperationType = null;
> } else {
>     final RecordPath recordPath = 
> RecordPath.compile(statementTypeRecordPathValue);
>     recordPathOperationType = new RecordPathStatementType(recordPath);
> } {code}
> This assumes that the RecordPath is valid or is not set. But that's 
> necessarily the case. Because the STATEMENT_TYPE_RECORD_PATH property depends 
> on the "Statement Type" property being set to "RecordPath", it is possible to 
> set the Statement Type to RecordPath, set an invalid RecordPath, and then 
> change the Statement Type to something else, such as INSERT.
> Now, the Processor fails to start, with a cryptic error message.
> The Processor needs to be updated to ensure that it does not attempt to 
> compile the RecordPath unless the "Statement Type" property is set to 
> "RecordPath".



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to