Skip to content

Commit

Permalink
THRIFT-5411: Catch SocketTimeoutException in TIOStreamTransport read
Browse files Browse the repository at this point in the history
  • Loading branch information
belugabehr authored and fishy committed Jun 4, 2021
1 parent 4abc5cf commit be20ad7
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.SocketTimeoutException;

/**
* This is the most commonly used base transport. It takes an InputStream or
Expand Down Expand Up @@ -174,6 +175,8 @@ public int read(byte[] buf, int off, int len) throws TTransportException {
int bytesRead;
try {
bytesRead = inputStream_.read(buf, off, len);
} catch (SocketTimeoutException ste) {
throw new TTransportException(TTransportException.TIMED_OUT, ste);
} catch (IOException iox) {
throw new TTransportException(TTransportException.UNKNOWN, iox);
}
Expand Down

0 comments on commit be20ad7

Please sign in to comment.