mirror of
https://github.com/valitydev/thrift.git
synced 2024-11-07 02:45:22 +00:00
THRIFT-661. java: Detect EOF in TIOStreamTransport
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@920659 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
487fd2e043
commit
bec15e5105
@ -122,11 +122,16 @@ public class TIOStreamTransport extends TTransport {
|
||||
if (inputStream_ == null) {
|
||||
throw new TTransportException(TTransportException.NOT_OPEN, "Cannot read from null inputStream");
|
||||
}
|
||||
int bytesRead;
|
||||
try {
|
||||
return inputStream_.read(buf, off, len);
|
||||
bytesRead = inputStream_.read(buf, off, len);
|
||||
} catch (IOException iox) {
|
||||
throw new TTransportException(TTransportException.UNKNOWN, iox);
|
||||
}
|
||||
if (bytesRead < 0) {
|
||||
throw new TTransportException(TTransportException.END_OF_FILE);
|
||||
}
|
||||
return bytesRead;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user