Github user joewitt commented on a diff in the pull request:
https://github.com/apache/nifi/pull/314#discussion_r58008694
--- Diff:
nifi-nar-bundles/nifi-kafka-bundle/nifi-kafka-processors/src/main/java/org/apache/nifi/processors/kafka/StreamScanner.java
---
@@ -55,29 +56,53 @@
*/
boolean hasNext() {
this.data = null;
- if (!this.eos) {
+ int j = 0;
+ boolean moreData = true;
+ byte b;
+ while (this.data == null) {
+ this.expandBufferIfNecessary();
try {
- boolean keepReading = true;
- while (keepReading) {
- byte b = (byte) this.is.read();
- if (b > -1) {
- baos.write(b);
- if (buffer.addAndCompare(b)) {
- this.data =
Arrays.copyOfRange(baos.getUnderlyingBuffer(), 0, baos.size() -
delimiter.length);
- keepReading = false;
- }
- } else {
- this.data = baos.toByteArray();
- keepReading = false;
- this.eos = true;
+ b = (byte) this.is.read();
--- End diff --
is.read() returns an int and -1 and represents end of stream. Once that
has been verified can the byte value as represented in the range of 0 to 255.
Will submit a patch containing a test that proves it is broken and will make
the fix.
---
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.
---