Bryan Bende created NIFI-3949:
---------------------------------
Summary: NullPointerException from GrokReader
Key: NIFI-3949
URL: https://issues.apache.org/jira/browse/NIFI-3949
Project: Apache NiFi
Issue Type: Bug
Affects Versions: 1.2.0
Reporter: Bryan Bende
Priority: Minor
When creating a GrokReader, I specified an expression of:
%\{SYSLOGBASE\}%\{GREEDYDATA:message\}
And I left the default schema strategy of "use fields from grok expression".
This resulted in an NPE:
{code}
java.lang.NullPointerException: null
at java.util.Objects.requireNonNull(Objects.java:203)
at
org.apache.nifi.serialization.record.RecordField.<init>(RecordField.java:50)
at
org.apache.nifi.serialization.record.RecordField.<init>(RecordField.java:33)
at
org.apache.nifi.grok.GrokReader.createRecordSchema(GrokReader.java:150)
at org.apache.nifi.grok.GrokReader.preCompile(GrokReader.java:136)
{code}
This appears to be because I didn't specify a name for SYSLOGBASE, since I was
expecting it to see what SYSLOGBASE expands to and then use and named fields
under that. If we don't want to support that expansion, then we should at least
validate that all parts of the Grok expression have a name.
Next I changed to using a schema defined in an AvroSchemaRegistry and
referencing it by name, but I still got the above exception because the
preCompile method always attempts to create a RecordSchema from the
GrokExpression, even if you selected a different strategy.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)