Github user markobean commented on a diff in the pull request:
https://github.com/apache/nifi/pull/444#discussion_r65471941
--- Diff:
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestSplitText.java
---
@@ -39,6 +39,303 @@
+
"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nLastLine\n";
@Test
+ public void testLastLineExceedsSizeLimit() {
+ final TestRunner runner = TestRunners.newTestRunner(new
SplitText());
+ runner.setProperty(SplitText.HEADER_LINE_COUNT, "0");
+ runner.setProperty(SplitText.LINE_SPLIT_COUNT, "2");
+ runner.setProperty(SplitText.FRAGMENT_MAX_SIZE, "20 B");
+
+ runner.enqueue("Line #1\nLine #2\nLine #3\nLong line exceeding
limit");
+ runner.run();
+
+ runner.assertTransferCount(SplitText.REL_FAILURE, 0);
+ runner.assertTransferCount(SplitText.REL_ORIGINAL, 1);
+ runner.assertTransferCount(SplitText.REL_SPLITS, 3);
+ }
--- End diff --
Talk about thorough! I don't know how you managed to catch this edge case.
However, for completeness, the RTN functionality once again increased
complexity and another buffer count was added. Now, if the size limit is
exceeded (with RTN = true and no header lines), then the number of EOL bytes
previously added to the info.lengthBytes are subtracted from the previous line
effectively removing the final EOL characters of the split.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---