Fixed issue: NETTY-234 ChunkedStream usage fails with NegativeArraySize error
* Worked around an interesting JDK issue where InputStream.available() returns a negative value
This commit is contained in:
parent
ab2283ee98
commit
6886a8b765
@ -93,7 +93,13 @@ public class ChunkedStream implements ChunkedInput {
|
||||
return null;
|
||||
}
|
||||
|
||||
final int chunkSize = Math.min(this.chunkSize, in.available());
|
||||
final int availableBytes = in.available();
|
||||
final int chunkSize;
|
||||
if (availableBytes <= 0) {
|
||||
chunkSize = this.chunkSize;
|
||||
} else {
|
||||
chunkSize = Math.min(this.chunkSize, in.available());
|
||||
}
|
||||
final byte[] chunk = new byte[chunkSize];
|
||||
int readBytes = 0;
|
||||
for (;;) {
|
||||
|
Loading…
Reference in New Issue
Block a user