[jboss-cvs] JBossRemoting/src/main/org/jboss/remoting/transport/http ...

Ron Sigal ron_sigal at yahoo.com
Tue Oct 9 18:22:25 EDT 2007


  User: rsigal  
  Date: 07/10/09 18:22:25

  Modified:    src/main/org/jboss/remoting/transport/http  Tag:
                        remoting_2_2_0_GA HTTPClientInvoker.java
  Log:
  JBREM-813:  Added additional exception handling code so that ServletServerInvoker can return an actual exception.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.31.2.3.4.5 +32 -3     JBossRemoting/src/main/org/jboss/remoting/transport/http/HTTPClientInvoker.java
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: HTTPClientInvoker.java
  ===================================================================
  RCS file: /cvsroot/jboss/JBossRemoting/src/main/org/jboss/remoting/transport/http/HTTPClientInvoker.java,v
  retrieving revision 1.31.2.3.4.4
  retrieving revision 1.31.2.3.4.5
  diff -u -b -r1.31.2.3.4.4 -r1.31.2.3.4.5
  --- HTTPClientInvoker.java	13 Sep 2007 03:28:19 -0000	1.31.2.3.4.4
  +++ HTTPClientInvoker.java	9 Oct 2007 22:22:25 -0000	1.31.2.3.4.5
  @@ -39,6 +39,7 @@
   import org.jboss.remoting.marshal.http.HTTPMarshaller;
   import org.jboss.remoting.marshal.serializable.SerializableUnMarshaller;
   import org.jboss.remoting.serialization.ClassLoaderUtility;
  +import org.jboss.remoting.transport.servlet.ServletThrowable;
   import org.jboss.remoting.transport.web.WebUtil;
   import org.jboss.util.Base64;
   import org.jboss.util.threadpool.BasicThreadPool;
  @@ -334,7 +335,10 @@
         }
   
         // now check for error response and throw exception unless configured to not do so
  -      if(responseCode >= 400)
  +      if(responseCode >= 400 
  +            || ("servlet".equals(getLocator().getProtocol())
  +                  && result instanceof InvocationResponse
  +                  && ((InvocationResponse) result).getResult() instanceof ServletThrowable))
         {
            if(metadata != null)
            {
  @@ -352,7 +356,16 @@
                     }
                     else if (result instanceof InvocationResponse)
                     {
  -                     return ((InvocationResponse) result).getResult();
  +                     InvocationResponse response = (InvocationResponse) result;
  +                     Object innerResult = response.getResult();
  +                     if (innerResult instanceof ServletThrowable)
  +                     {
  +                        return ((ServletThrowable) innerResult).getCause();
  +                     }
  +                     else
  +                     {
  +                        return innerResult;
  +                     }
                     }
                     else
                     {
  @@ -368,7 +381,23 @@
            // In this case, MicroRemoteClientInvoker will throw the exception carried by
            // the InvocationResponse.
            if (result instanceof InvocationResponse)
  +         {
  +            if ((((InvocationResponse) result).getResult()) instanceof ServletThrowable)
  +            {
  +               InvocationResponse response = (InvocationResponse) result;
  +               ServletThrowable st = (ServletThrowable) response.getResult();
  +               Throwable t = st.getCause();
  +               InvocationResponse ir = new InvocationResponse(response.getSessionId(),
  +                                                              t,
  +                                                              response.isException(),
  +                                                              response.getPayload());
  +               return ir;
  +            }
  +            else
  +            {
               return result;
  +            }
  +         }
   
            // Otherwise, create a new WebServerError.
            if(result instanceof String)
  
  
  



More information about the jboss-cvs-commits mailing list