THRIFT-517. java:TExceptions thrown by server result in cryptic error message on client - Tried to read 4 bytes, but only got 0 bytes
This tiny change improves the message to make it marginally more obvious that the server-side might be the culprit.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1028131 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/java/src/org/apache/thrift/transport/TTransport.java b/lib/java/src/org/apache/thrift/transport/TTransport.java
index 378efdc..c4086ba 100644
--- a/lib/java/src/org/apache/thrift/transport/TTransport.java
+++ b/lib/java/src/org/apache/thrift/transport/TTransport.java
@@ -83,7 +83,12 @@
while (got < len) {
ret = read(buf, off+got, len-got);
if (ret <= 0) {
- throw new TTransportException("Cannot read. Remote side has closed. Tried to read " + len + " bytes, but only got " + got + " bytes.");
+ throw new TTransportException(
+ "Cannot read. Remote side has closed. Tried to read "
+ + len
+ + " bytes, but only got "
+ + got
+ + " bytes. (This is often indicative of an internal error on the server side. Please check your server logs.)");
}
got += ret;
}