Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Won't Fix
-
1.17.0
-
None
-
None
Description
Per the Expression Language documentation for jsonPath "An empty string is generated if the Subject does not contain valid JSON, the jsonPath is invalid, or the path does not exist in the Subject." Further in the documentation it states "An empty subject value or a subject value with an invalid JSON document results in an exception bulletin." This would seem to indicate with invalid JSON an empty string is returned and the processor which is handling the Expression Language will get an empty string and not have to yield any flow files. Attached is a template which indicates that instead of a returned empty string, an exception is thrown and the processor is yielding flow files causing its queue to backup.
The attached template JsonPathInvalidJsonYieldsFlowFiles.xml
uses a RouteOnAttributeProcessor to determine whether an attribute value is valid JSON or not. Two Expression Language expressions are used both of which use JsonPath of $ (which should return the whole JSON document) chained with isEmpty():not() or isEmpty() to determine if the attribute value is valid JSON or not.
Note how the flow file with a valid JSON attribute is routed correctly while the flow file with invalid JSON is yielded and not routed correctly. Instead of routing to the invalid relationship the flow files are backing up in the queue.
Attachments
Attachments
Issue Links
- is fixed by
-
NIFI-10612 Create new Expression Language method isJson to determine whether an attribute is JSON
- Resolved