[ 
https://issues.apache.org/jira/browse/NIFI-4188?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16092541#comment-16092541
 ] 

ASF GitHub Bot commented on NIFI-4188:
--------------------------------------

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?


> Create RethinkDB get processor
> ------------------------------
>
>                 Key: NIFI-4188
>                 URL: https://issues.apache.org/jira/browse/NIFI-4188
>             Project: Apache NiFi
>          Issue Type: New Feature
>          Components: Extensions
>    Affects Versions: 1.3.0
>         Environment: All
>            Reporter: Mans Singh
>            Assignee: Mans Singh
>            Priority: Minor
>              Labels: document, get, rethinkdb
>             Fix For: 1.4.0
>
>
> Create processor for getting documents by id from RethinkDB



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to