Skip to content

Commit 6b95338

Browse files
committed
Merge pull request #486 from KostyaSha/fixCompletion
Fix NegativeArraySizeException in awaitCompletion()
2 parents 423998b + b2e852c commit 6b95338

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/main/java/com/github/dockerjava/core/command/FrameReader.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
import com.github.dockerjava.api.model.Frame;
88
import com.github.dockerjava.api.model.StreamType;
99

10+
import javax.annotation.CheckForNull;
11+
1012
/**
1113
* Breaks the input into frame. Similar to how a buffered reader would readLies.
1214
* <p/>
@@ -42,14 +44,16 @@ private static StreamType streamType(byte streamType) {
4244
/**
4345
* @return A frame, or null if no more frames.
4446
*/
47+
@CheckForNull
4548
public Frame readFrame() throws IOException {
4649

4750
if (rawStreamDetected) {
48-
4951
int read = inputStream.read(rawBuffer);
52+
if (read == -1) {
53+
return null;
54+
}
5055

5156
return new Frame(StreamType.RAW, Arrays.copyOf(rawBuffer, read));
52-
5357
} else {
5458

5559
byte[] header = new byte[HEADER_SIZE];

0 commit comments

Comments
 (0)