THRIFT-1588 Java Generated Exceptions don't follow inheritance pattern as other Languages
- fix the build!
- add test/gen-html for ThriftTest.thrift
git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1333628 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/java/test/org/apache/thrift/test/TestClient.java b/lib/java/test/org/apache/thrift/test/TestClient.java
old mode 100644
new mode 100755
index 85dbecd..45369ba
--- a/lib/java/test/org/apache/thrift/test/TestClient.java
+++ b/lib/java/test/org/apache/thrift/test/TestClient.java
@@ -23,6 +23,7 @@
import thrift.test.*;
import org.apache.thrift.TApplicationException;
+import org.apache.thrift.TException;
import org.apache.thrift.TSerializer;
import org.apache.thrift.transport.TTransport;
import org.apache.thrift.transport.TSocket;
@@ -381,15 +382,15 @@
testClient.testException("Xception");
System.out.print(" void\nFAILURE\n");
} catch(Xception e) {
- System.out.print(" {%u, \"%s\"}\n", e.errorCode, e.message.c_str());
+ System.out.printf(" {%u, \"%s\"}\n", e.errorCode, e.message);
}
try {
- System.out.print("testClient.testException(\"Xception\") =>");
- testClient.testException("Xception");
+ System.out.print("testClient.testException(\"TException\") =>");
+ testClient.testException("TException");
System.out.print(" void\nFAILURE\n");
} catch(TException e) {
- System.out.print(" {%u, \"%s\"}\n", e.errorCode, e.message.c_str());
+ System.out.printf(" {\"%s\"}\n", e.getMessage());
}
try {
@@ -397,7 +398,7 @@
testClient.testException("success");
System.out.print(" void\n");
}catch(Exception e) {
- System.out.print(" exception\nFAILURE\n");
+ System.out.printf(" exception\nFAILURE\n");
}
@@ -406,27 +407,28 @@
*/
try {
- System.out.print("testClient.testMultiException(\"Xception\", \"test 1\") =>");
+ System.out.printf("testClient.testMultiException(\"Xception\", \"test 1\") =>");
testClient.testMultiException("Xception", "test 1");
System.out.print(" result\nFAILURE\n");
} catch(Xception e) {
- System.out.print(" {%u, \"%s\"}\n", e.errorCode, e.message.c_str());
+ System.out.printf(" {%u, \"%s\"}\n", e.errorCode, e.message);
}
try {
- System.out.print("testClient.testMultiException(\"Xception2\", \"test 2\") =>");
+ System.out.printf("testClient.testMultiException(\"Xception2\", \"test 2\") =>");
testClient.testMultiException("Xception2", "test 2");
System.out.print(" result\nFAILURE\n");
} catch(Xception2 e) {
- System.out.print(" {%u, {\"%s\"}}\n", e.errorCode, e.struct_thing.string_thing.c_str());
+ System.out.printf(" {%u, {\"%s\"}}\n", e.errorCode, e.struct_thing.string_thing);
}
try {
System.out.print("testClient.testMultiException(\"success\", \"test 3\") =>");
- testClient.testMultiException("success", "test 3");
- System.out.print(" {{\"%s\"}}\n", result.string_thing.c_str());
+ Xtruct result;
+ result = testClient.testMultiException("success", "test 3");
+ System.out.printf(" {{\"%s\"}}\n", result.string_thing);
} catch(Exception e) {
- System.out.print(" exception\nFAILURE\n");
+ System.out.printf(" exception\nFAILURE\n");
}
diff --git a/test/Makefile.am b/test/Makefile.am
old mode 100644
new mode 100755
index 2b3b8a9..1ad9063
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -44,6 +44,12 @@
SUBDIRS += hs
endif
+#
+# generate html for ThriftTest.thrift
+#
+check-local:
+ $(top_builddir)/compiler/cpp/thrift --gen html -r $(top_srcdir)/test/ThriftTest.thrift
+
EXTRA_DIST = \
cpp \
csharp \
diff --git a/test/cpp/src/TestClient.cpp b/test/cpp/src/TestClient.cpp
index f461a87..a1af77e 100755
--- a/test/cpp/src/TestClient.cpp
+++ b/test/cpp/src/TestClient.cpp
@@ -530,8 +530,8 @@
}
try {
- printf("testClient.testException(\"Xception\") =>");
- testClient.testException("Xception");
+ printf("testClient.testException(\"TException\") =>");
+ testClient.testException("TException");
printf(" void\nFAILURE\n");
} catch(TException& e) {