You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by ijokarumawak <gi...@git.apache.org> on 2017/01/17 00:49:18 UTC

[GitHub] nifi issue #1409: NIFI-1962 - Fixed NPE in toDate() EL function

Github user ijokarumawak commented on the issue:

    https://github.com/apache/nifi/pull/1409
  
    Thanks @pvillard31 for tackling this. I reviewed the code and tested. While this PR fixes toDate to work even when an attribute value is null, there's another method that throws NPE, that is StandardAttributeExpression.evaluate. It has similar code.
    
    Also, I felt that changing Query class is too much for fixing a particular toDate EL function. Besides that, when I tested toNumber passing a non-existing attribute, it works fine, before applying this fix.
    
    So I looked at the code closer and found NumberToDateEvaluator may be the one should be fixed, because functions below react against null input value as followings:
    
    - NumberToDateEvaluator returns `null` <-- We probably need to fix this to return new DateQueryResult(null)
    - StringToDateEvaluator returns new DateQueryResult(null)
    - WholeNumberCastEvaluator returns new WholeNumberQueryResult(null) : this is an implementation for toNumber() function
    
    It seems returning XXXQueryResult(null) is a convention in EL functions when input is null.
    
    How do you think?


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---