Github user jvwing commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/2012#discussion_r128149561
  
    --- Diff: 
nifi-nar-bundles/nifi-rethinkdb-bundle/nifi-rethinkdb-processors/src/main/java/org/apache/nifi/processors/rethinkdb/GetRethinkDB.java
 ---
    @@ -137,9 +135,9 @@ public void onTrigger(final ProcessContext context, 
final ProcessSession session
             String id = 
context.getProperty(RETHINKDB_DOCUMENT_ID).evaluateAttributeExpressions(flowFile).getValue();
             String readMode = 
context.getProperty(READ_MODE).evaluateAttributeExpressions(flowFile).getValue();
     
    -        if ( StringUtils.isEmpty(id) ) {
    -            getLogger().error("Empty id '" + id + "'");
    -            flowFile = session.putAttribute(flowFile, 
RETHINKDB_ERROR_MESSAGE, "Empty id '" + id + "'");
    +        if ( StringUtils.isBlank(id) ) {
    --- End diff --
    
    I do not recommend this change to using `isBlank()`, because it will return 
true if the id is whitespace only, and I believe whitespace is in fact a valid 
RethinkDB key.
    
    I'm sorry I was not clear about my concern.  In the earlier code using 
`isEmpty()`, the if block would be entered if id was null or an empty string.  
However, property values are not null, they would be an empty string at least.  
So the block appeared to only be entered in practice if id was an empty string. 
 Given that we knew id was always an empty string, it did not seem necessary to 
interpolate the value.  It is an empty string, and the result is always the 
same.
    
    This appeared to be confirmed by your testBlankId() unit test that 
exercised this code and checked its value against `Blank id ''`.  It appears to 
be further confirmed by the new testNullId() unit test that checks against the 
exact same value. 
    
    How about just logging it as `Document Identifier cannot be empty` or 
similar?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to