From a8738b5560db8216c06d0a8cea116b7f29255e8e Mon Sep 17 00:00:00 2001 From: Roger Meier Date: Tue, 22 Feb 2011 20:15:03 +0000 Subject: [PATCH] THRIFT-1065 Unexpected exceptions not proper handled on JS THRIFT-847 same bahavior for Java and C++(test/cpp/src/TestServer.cpp) Patch: Henrique Mendonca git-svn-id: https://svn.apache.org/repos/asf/thrift/trunk@1073484 13f79535-47bb-0310-9956-ffa450edef68 --- .../test/org/apache/thrift/server/ServerTestBase.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/java/test/org/apache/thrift/server/ServerTestBase.java b/lib/java/test/org/apache/thrift/server/ServerTestBase.java index 95425203..8bd2cef7 100644 --- a/lib/java/test/org/apache/thrift/server/ServerTestBase.java +++ b/lib/java/test/org/apache/thrift/server/ServerTestBase.java @@ -29,6 +29,7 @@ import java.util.Set; import junit.framework.TestCase; import org.apache.thrift.TException; +import org.apache.thrift.TApplicationException; import org.apache.thrift.TProcessor; import org.apache.thrift.protocol.TBinaryProtocol; import org.apache.thrift.protocol.TCompactProtocol; @@ -227,13 +228,18 @@ public abstract class ServerTestBase extends TestCase { return hello; } - public void testException(String arg) throws Xception { + public void testException(String arg) throws Xception, TApplicationException { System.out.print("testException("+arg+")\n"); if (arg.equals("Xception")) { Xception x = new Xception(); x.errorCode = 1001; x.message = "This is an Xception"; throw x; + } else if (arg.equals("ApplicationException")) { + throw new TApplicationException("This is a ApplicationException"); + } else { + Xtruct result = new Xtruct(); + result.string_thing = arg; } return; } -- 2.17.1