mrcsparker / nifi-edireader-bundle

Apache NIFI processor that converts EDI ASC X12 and EDIFACT documents into XML
33 stars 8 forks source link

Fix for simultaneous read/write error that came up in newer versions. #2

Closed patricker closed 7 years ago

patricker commented 7 years ago

I tend to run a pretty bleeding edge version of NiFi. When I upgraded to the latest 1.4.0 codebase this processor started failing.

The line causing the failure: FlowFile updatedFlowFile = session.write(flowFile, (inputStream, outputStream) -> outputStream.write(output.toString().getBytes()));

The error stated that NiFi couldn't write to a FlowFile that was still open. I tried a lot of fixes out, such as closing the input before writing the output, but settled on the code in this PR as it matches what I've seen with other converter processors.

Also, testOnTrigger is failing, but in my testing of the processor I haven't run into issues. Didn't dig into the test case.