[jboss-dev-forums] [Design of JBoss Remoting, Unified Invokers] - Re: Exception propagation using HTTP servlet transport on 1.
tom.elrod@jboss.com
do-not-reply at jboss.com
Wed Jan 17 20:51:09 EST 2007
Just ran the org.jboss.test.remoting.transport.servlet.ServletInvokerTestClient test (which extends org.jboss.test.remoting.transport.web.WebInvokerTestClient) with latest JBossAS 4.2.0 code base and remoting code base (see src/test/org/jboss/test/remoting/transport/servlet/readme.txt for instructions how to setup test).
The code within WebInvokerTestClient that tests exception handling looks like:
| Object response = null;
| try
| {
| response = remotingClient.invoke(WebInvocationHandler.THROW_EXCEPTION_PARAM, metadata);
| assertTrue("Should have thrown WebServerError and not made it to here.", false);
| }
| catch (IOException error)
| {
| // having to check class name instead of just catching type WebServerError so
| // can use for backwards compatibility tests since WebServerError is new since 2.0.0.CR1.
| if (error.getClass().getName().endsWith("WebServerError"))
| {
| assertTrue(true);
| }
| else
| {
| assertTrue("Did not get WebServerError thrown as expected", false);
| }
| }
| metadata.put(HTTPMetadataConstants.NO_THROW_ON_ERROR, "true");
| response = remotingClient.invoke(WebInvocationHandler.THROW_EXCEPTION_PARAM, metadata);
| if (response instanceof Exception)
| {
| System.out.println("Return from invocation is of type Exception as expected.");
| assertTrue("Received exception return as expected.", true);
| }
| else
| {
| System.out.println("Did not get Exception type returned as expected.");
| assertTrue("Should have received Exception as return.", false);
| }
|
This test passes when running with the servlet invoker.
In the case of servlet invoker, org.jboss.remoting.transport.http.WebServerError is thrown (or returned for the second invocation), so the original exception thrown on the server side is not the one thrown on the client side.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4003122#4003122
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4003122
More information about the jboss-dev-forums
mailing list