mirror of https://github.com/apache/nifi.git
NIFI-181: Applied fix that is illustrated in ticket description. If calling LeakyBucketStreamThrottler's InputStream.read(byte[], int, int) and pass 0 as the length, it should just return 0
This commit is contained in:
parent
3997f9b2b0
commit
84d6255d68
|
@ -112,6 +112,13 @@ public class LeakyBucketStreamThrottler implements StreamThrottler {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int read(byte[] b, int off, int len) throws IOException {
|
public int read(byte[] b, int off, int len) throws IOException {
|
||||||
|
if ( len < 0 ) {
|
||||||
|
throw new IllegalArgumentException();
|
||||||
|
}
|
||||||
|
if ( len == 0 ) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
baos.reset();
|
baos.reset();
|
||||||
final int copied = (int) LeakyBucketStreamThrottler.this.copy(toWrap, baos, len);
|
final int copied = (int) LeakyBucketStreamThrottler.this.copy(toWrap, baos, len);
|
||||||
if (copied == 0) {
|
if (copied == 0) {
|
||||||
|
|
Loading…
Reference in New Issue