You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by di...@apache.org on 2003/06/27 20:35:05 UTC

cvs commit: xml-axis/java/src/org/apache/axis/handlers/soap SOAPService.java

dims        2003/06/27 11:35:05

  Modified:    java/src/org/apache/axis/handlers HandlerChainImpl.java
               java/src/org/apache/axis/handlers/soap SOAPService.java
  Log:
  Fix for Bug 20801 - AXIS doesn't invoke handleFault when SOAPFaultException is thrown
  from kimuratsy@nttdata.co.jp (Toshiyuki Kimura)
  
  Fix for Bug 20803 - AXIS doesn't catch any kind of RuntimeException on handler
  from kimuratsy@nttdata.co.jp (Toshiyuki Kimura)
  
  Revision  Changes    Path
  1.11      +1 -0      xml-axis/java/src/org/apache/axis/handlers/HandlerChainImpl.java
  
  Index: HandlerChainImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/handlers/HandlerChainImpl.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- HandlerChainImpl.java	22 Apr 2003 19:34:39 -0000	1.10
  +++ HandlerChainImpl.java	27 Jun 2003 18:35:05 -0000	1.11
  @@ -138,6 +138,7 @@
                       return false;
                   }
               } catch (SOAPFaultException sfe) {
  +                currentHandler.handleFault(context);
                   throw sfe;
               }
           }
  
  
  
  1.98      +29 -12    xml-axis/java/src/org/apache/axis/handlers/soap/SOAPService.java
  
  Index: SOAPService.java
  ===================================================================
  RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/handlers/soap/SOAPService.java,v
  retrieving revision 1.97
  retrieving revision 1.98
  diff -u -r1.97 -r1.98
  --- SOAPService.java	22 Apr 2003 19:34:44 -0000	1.97
  +++ SOAPService.java	27 Jun 2003 18:35:05 -0000	1.98
  @@ -89,6 +89,9 @@
   import java.util.Hashtable;
   import java.util.Vector;
   
  +import javax.xml.rpc.soap.SOAPFaultException;
  +import org.apache.axis.message.SOAPFault;
  +import org.apache.axis.Message;
   
   /** A <code>SOAPService</code> is a Handler which encapsulates a SOAP
    * invocation.  It has an request chain, an response chain, and a pivot-point,
  @@ -473,19 +476,33 @@
           if (handlerFactory != null) handlerImpl = (HandlerChainImpl) handlerFactory.createHandlerChain();
           boolean result = true;
           
  -        if (handlerImpl != null) {
  -            result = handlerImpl.handleRequest(msgContext);
  -        }
  -        
  -        if (result) {
  -            super.invoke(msgContext);
  -        } else {
  -            msgContext.setPastPivot(true);
  -        }
  +        try {
  +            if (handlerImpl != null) {
  +                result = handlerImpl.handleRequest(msgContext);
  +            }
  +
  +            if (result) {
  +                super.invoke(msgContext);
  +            } else {
  +                msgContext.setPastPivot(true);
  +            }
    
  -        if ( handlerImpl != null) {
  -            handlerImpl.handleResponse(msgContext);
  -            handlerImpl.destroy();
  +            if ( handlerImpl != null) {
  +                handlerImpl.handleResponse(msgContext);
  +                handlerImpl.destroy();
  +            }
  +        } catch (SOAPFaultException e) {
  +            msgContext.setPastPivot(true);
  +            throw new AxisFault(e.getMessage());
  +            
  +        } catch (RuntimeException e) {
  +            SOAPFault fault = new SOAPFault(new AxisFault("Server", "Server Error", null, null));
  +            SOAPEnvelope env = new SOAPEnvelope();
  +            env.addBodyElement(fault);
  +            Message message = new Message(env);
  +            message.setMessageType(Message.RESPONSE);
  +            msgContext.setResponseMessage(message);
  +            throw new AxisFault(e.getMessage());
           }
       }
   }