Re: [jira] [Commented] (NIFI-476) EvaluateJsonPath fails with NullPointerException on null values

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: [jira] [Commented] (NIFI-476) EvaluateJsonPath fails with NullPointerException on null values

Mark Payne
Aldrin,

A heads up here just make sure you are aware: you cannot add an attribute with a null value.

Sent from my iPhone

> On Apr 17, 2015, at 11:35 PM, Aldrin Piri (JIRA) <[hidden email]> wrote:
>
>
>    [ https://issues.apache.org/jira/browse/NIFI-476?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14501069#comment-14501069 ]
>
> Aldrin Piri commented on NIFI-476:
> ----------------------------------
>
> Thanks for the test case.  
>
> Providing code to solve the inappropriate treatment of null values.  Additionally provided a user configurable option to specify if null values should be treated as an empty string or as the literal string "null".
>
>> EvaluateJsonPath fails with NullPointerException on null values
>> ---------------------------------------------------------------
>>
>>                Key: NIFI-476
>>                URL: https://issues.apache.org/jira/browse/NIFI-476
>>            Project: Apache NiFi
>>         Issue Type: Bug
>>         Components: Extensions
>>   Affects Versions: 0.0.2, 0.1.0
>>           Reporter: Brian Ghigiarelli
>>           Assignee: Aldrin Piri
>>            Fix For: 0.1.0
>>
>>        Attachments: NIFI-476-EvaluateJsonPath-Null-Value-Test.patch
>>
>>
>> The EvaluateJsonPath processor fails with a NullPointerException when the input JSON has a null value in the contents of a field it is evaluating.
>> {code:none}
>> Caused by: java.lang.NullPointerException
>>    at org.apache.nifi.processors.standard.AbstractJsonPathProcessor.getResultRepresentation(AbstractJsonPathProcessor.java:84)
>>    at org.apache.nifi.processors.standard.EvaluateJsonPath.onTrigger(EvaluateJsonPath.java:268)
>>    at org.apache.nifi.processor.AbstractProcessor.onTrigger(AbstractProcessor.java:27)
>> {code}
>> null is a valid value in the [JSON spec|http://www.json.org/]
>> The current spec of EvaluateJsonPath from NIFI-360 indicated that any missing fields should be given an empty string attribute value in the output flow file sent to "match".
>> null values should either follow this same pattern, or perhaps allow for null values in the output FlowFile attributes to properly indicate the difference between null and an empty String.  Either way, EvaluateJsonPath should handle null input values instead of throwing exceptions.
>
>
>
> --
> This message was sent by Atlassian JIRA
> (v6.3.4#6332)
Reply | Threaded
Open this post in threaded view
|

Re: [jira] [Commented] (NIFI-476) EvaluateJsonPath fails with NullPointerException on null values

Aldrin Piri
Mark,

I think I recall that but could you provide some context on why that was
mentioned? Is it over the configurable representation of null values? If
so, maybe I've walked into some poor usability with the new property. The
default null value provides either an empty string or the string "null" as
the value. I'm open to better ways to express that and probably mulled that
wording over longer than the actual fix took.

If it is not about that property, could you point me in the right direction?
On Sat, Apr 18, 2015 at 08:18 Mark Payne <[hidden email]> wrote:

> Aldrin,
>
> A heads up here just make sure you are aware: you cannot add an attribute
> with a null value.
>
> Sent from my iPhone
>
> > On Apr 17, 2015, at 11:35 PM, Aldrin Piri (JIRA) <[hidden email]>
> wrote:
> >
> >
> >    [
> https://issues.apache.org/jira/browse/NIFI-476?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14501069#comment-14501069
> ]
> >
> > Aldrin Piri commented on NIFI-476:
> > ----------------------------------
> >
> > Thanks for the test case.
> >
> > Providing code to solve the inappropriate treatment of null values.
> Additionally provided a user configurable option to specify if null values
> should be treated as an empty string or as the literal string "null".
> >
> >> EvaluateJsonPath fails with NullPointerException on null values
> >> ---------------------------------------------------------------
> >>
> >>                Key: NIFI-476
> >>                URL: https://issues.apache.org/jira/browse/NIFI-476
> >>            Project: Apache NiFi
> >>         Issue Type: Bug
> >>         Components: Extensions
> >>   Affects Versions: 0.0.2, 0.1.0
> >>           Reporter: Brian Ghigiarelli
> >>           Assignee: Aldrin Piri
> >>            Fix For: 0.1.0
> >>
> >>        Attachments: NIFI-476-EvaluateJsonPath-Null-Value-Test.patch
> >>
> >>
> >> The EvaluateJsonPath processor fails with a NullPointerException when
> the input JSON has a null value in the contents of a field it is evaluating.
> >> {code:none}
> >> Caused by: java.lang.NullPointerException
> >>    at
> org.apache.nifi.processors.standard.AbstractJsonPathProcessor.getResultRepresentation(AbstractJsonPathProcessor.java:84)
> >>    at
> org.apache.nifi.processors.standard.EvaluateJsonPath.onTrigger(EvaluateJsonPath.java:268)
> >>    at
> org.apache.nifi.processor.AbstractProcessor.onTrigger(AbstractProcessor.java:27)
> >> {code}
> >> null is a valid value in the [JSON spec|http://www.json.org/]
> >> The current spec of EvaluateJsonPath from NIFI-360 indicated that any
> missing fields should be given an empty string attribute value in the
> output flow file sent to "match".
> >> null values should either follow this same pattern, or perhaps allow
> for null values in the output FlowFile attributes to properly indicate the
> difference between null and an empty String.  Either way, EvaluateJsonPath
> should handle null input values instead of throwing exceptions.
> >
> >
> >
> > --
> > This message was sent by Atlassian JIRA
> > (v6.3.4#6332)
>