[
https://issues.apache.org/jira/browse/NIFI-6682?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16938772#comment-16938772
]
Frank Chen edited comment on NIFI-6682 at 9/26/19 4:24 PM:
-----------------------------------------------------------
[~otto]
@Test
public void testSplit_pathToInputStringNullValue() throws Exception {
final TestRunner testRunner = TestRunners.newTestRunner(new SplitJson());
testRunner.setProperty(SplitJson.ARRAY_JSON_PATH_EXPRESSION, "$.*");
ProcessSession session = testRunner.getProcessSessionFactory().createSession();
FlowFile ff = session.create();
ff = session.write(ff, new OutputStreamCallback() {
@Override
public void process(OutputStream out) throws IOException {
try (OutputStream outputStream = new BufferedOutputStream(out)) {
outputStream.write("null".getBytes(StandardCharsets.UTF_8));
}
}
});
testRunner.enqueue(ff);
testRunner.run();
testRunner.assertTransferCount(SplitJson.REL_FAILURE, 1);
}
was (Author: dust2sleep):
[~otto]
*@Test*
*public void testSplit_pathToInputStringNullValue() throws Exception {*
*final TestRunner testRunner = TestRunners.newTestRunner(new SplitJson());*
*testRunner.setProperty(SplitJson.ARRAY_JSON_PATH_EXPRESSION, "$.*");*
*ProcessSession session =
testRunner.getProcessSessionFactory().createSession();*
*FlowFile ff = session.create();*
*ff = session.write(ff, new OutputStreamCallback() {*
*@Override*
*public void process(OutputStream out) throws IOException {*
*try (OutputStream outputStream = new BufferedOutputStream(out)) {*
*outputStream.write("null".getBytes(StandardCharsets.UTF_8));*
*}*
*}*
*});*
*testRunner.enqueue(ff);*
*testRunner.run();*
*testRunner.assertTransferCount(SplitJson.REL_FAILURE, 1);*
*}*
> SplitJson does not work if the input is null
> ---------------------------------------------
>
> Key: NIFI-6682
> URL: https://issues.apache.org/jira/browse/NIFI-6682
> Project: Apache NiFi
> Issue Type: Bug
> Components: Extensions
> Affects Versions: 1.9.2
> Reporter: Frank Chen
> Priority: Major
> Attachments: image-2019-09-17-18-18-19-860.png,
> image-2019-09-17-18-33-33-708.png
>
>
> When the input is String "null", the SplitJson processor should output to
> failure route rather than report error.As a result, the flowfile is not
> processed in the queue all the time.
>
>
>
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)