Github user olegz commented on a diff in the pull request:
https://github.com/apache/nifi/pull/1214#discussion_r102775809
--- Diff:
nifi-commons/nifi-utils/src/main/java/org/apache/nifi/stream/io/util/AbstractDemarcator.java
---
@@ -98,22 +136,26 @@ void fill() throws IOException {
}
int bytesRead;
+ /*
+ * The do/while pattern is used here similar to the way it is used
in
+ * BufferedReader essentially protecting from assuming the EOS
until it
+ * actually is since not every implementation of InputStream
guarantees
+ * that bytes are always available while the stream is open.
+ */
do {
bytesRead = this.is.read(this.buffer, this.index,
this.buffer.length - this.index);
} while (bytesRead == 0);
- this.bufferLength = bytesRead != -1 ? this.index + bytesRead : -1;
- if (this.bufferLength > this.maxDataSize) {
+ this.availableBytesLength = bytesRead != -1 ? this.index +
bytesRead : -1;
+ if (this.availableBytesLength > this.maxDataSize) {
--- End diff --
Hmm, good catch. It should only be compared to a token as it's being
computed, will 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.
---