Throw exception on 0-byte read.
This commit is contained in:
parent
a16a8b517c
commit
0e99996372
1 changed files with 2 additions and 1 deletions
|
@ -42,8 +42,9 @@ public final class Serialize {
|
||||||
int r = bc.read(buffer);
|
int r = bc.read(buffer);
|
||||||
if (r < 0) {
|
if (r < 0) {
|
||||||
throw new IOException("premature EOF");
|
throw new IOException("premature EOF");
|
||||||
|
} else if (r == 0) {
|
||||||
|
throw new IOException("Read zero bytes. Is the channel in non-blocking mode?");
|
||||||
}
|
}
|
||||||
// TODO check for r == 0 ?.
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue