You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@thrift.apache.org by ro...@apache.org on 2012/05/03 23:21:43 UTC

svn commit: r1333628 - in /thrift/trunk: lib/java/test/org/apache/thrift/test/TestClient.java test/Makefile.am test/cpp/src/TestClient.cpp

Author: roger
Date: Thu May  3 21:21:43 2012
New Revision: 1333628

URL: http://svn.apache.org/viewvc?rev=1333628&view=rev
Log:
THRIFT-1588 Java Generated Exceptions don't follow inheritance pattern as other Languages
- fix the build!
- add test/gen-html for ThriftTest.thrift

Modified:
    thrift/trunk/lib/java/test/org/apache/thrift/test/TestClient.java   (contents, props changed)
    thrift/trunk/test/Makefile.am   (contents, props changed)
    thrift/trunk/test/cpp/src/TestClient.cpp

Modified: thrift/trunk/lib/java/test/org/apache/thrift/test/TestClient.java
URL: http://svn.apache.org/viewvc/thrift/trunk/lib/java/test/org/apache/thrift/test/TestClient.java?rev=1333628&r1=1333627&r2=1333628&view=diff
==============================================================================
--- thrift/trunk/lib/java/test/org/apache/thrift/test/TestClient.java (original)
+++ thrift/trunk/lib/java/test/org/apache/thrift/test/TestClient.java Thu May  3 21:21:43 2012
@@ -23,6 +23,7 @@ package org.apache.thrift.test;
 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 @@ public class TestClient {
           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 @@ public class TestClient {
           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 @@ public class TestClient {
          */
         
         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");
         }
 
 

Propchange: thrift/trunk/lib/java/test/org/apache/thrift/test/TestClient.java
------------------------------------------------------------------------------
    svn:executable = *

Modified: thrift/trunk/test/Makefile.am
URL: http://svn.apache.org/viewvc/thrift/trunk/test/Makefile.am?rev=1333628&r1=1333627&r2=1333628&view=diff
==============================================================================
--- thrift/trunk/test/Makefile.am (original)
+++ thrift/trunk/test/Makefile.am Thu May  3 21:21:43 2012
@@ -44,6 +44,12 @@ if WITH_HASKELL
 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 \

Propchange: thrift/trunk/test/Makefile.am
------------------------------------------------------------------------------
    svn:executable = *

Modified: thrift/trunk/test/cpp/src/TestClient.cpp
URL: http://svn.apache.org/viewvc/thrift/trunk/test/cpp/src/TestClient.cpp?rev=1333628&r1=1333627&r2=1333628&view=diff
==============================================================================
--- thrift/trunk/test/cpp/src/TestClient.cpp (original)
+++ thrift/trunk/test/cpp/src/TestClient.cpp Thu May  3 21:21:43 2012
@@ -530,8 +530,8 @@ int main(int argc, char** argv) {
     }
 
     try {
-        printf("testClient.testException(\"Xception\") =>");
-        testClient.testException("Xception");
+        printf("testClient.testException(\"TException\") =>");
+        testClient.testException("TException");
         printf("  void\nFAILURE\n");
 
       } catch(TException& e) {