THRIFT-4858: Add error message to TTransportException
When the socket is closed (EOF of the inputstream), currently
TIOStreamTransport throws an TTransportException without message,
this is sometimes confusing for people maintaining a thrift server
(eg. apache hive).
Client: java
This closes #1876.
diff --git a/lib/java/src/org/apache/thrift/transport/TIOStreamTransport.java b/lib/java/src/org/apache/thrift/transport/TIOStreamTransport.java
index c8cd118..93b051f 100644
--- a/lib/java/src/org/apache/thrift/transport/TIOStreamTransport.java
+++ b/lib/java/src/org/apache/thrift/transport/TIOStreamTransport.java
@@ -129,7 +129,7 @@
throw new TTransportException(TTransportException.UNKNOWN, iox);
}
if (bytesRead < 0) {
- throw new TTransportException(TTransportException.END_OF_FILE);
+ throw new TTransportException(TTransportException.END_OF_FILE, "Socket is closed by peer.");
}
return bytesRead;
}