You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by di...@apache.org on 2005/02/05 18:50:12 UTC

cvs commit: ws-axis/java/src/org/apache/axis/server AxisServer.java

dims        2005/02/05 09:50:12

  Modified:    java/src/org/apache/axis/server AxisServer.java
  Log:
  Make explicit checks for NPE.
  
  Revision  Changes    Path
  1.92      +22 -7     ws-axis/java/src/org/apache/axis/server/AxisServer.java
  
  Index: AxisServer.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/server/AxisServer.java,v
  retrieving revision 1.91
  retrieving revision 1.92
  diff -u -r1.91 -r1.92
  --- AxisServer.java	25 Feb 2004 14:02:45 -0000	1.91
  +++ AxisServer.java	5 Feb 2005 17:50:12 -0000	1.92
  @@ -25,6 +25,7 @@
   import org.apache.axis.Message;
   import org.apache.axis.MessageContext;
   import org.apache.axis.SimpleTargetedChain;
  +import org.apache.axis.message.SOAPEnvelope;
   import org.apache.axis.soap.SOAPConstants;
   import org.apache.axis.client.AxisClient;
   import org.apache.axis.components.logger.LogFactory;
  @@ -274,13 +275,8 @@
                   if( tlog.isDebugEnabled() ) {
                       t3=System.currentTimeMillis();
                   }
  -
  -                // Ensure that if we get SOAP1.2, then reply using SOAP1.2 
  -                if(msgContext.getRequestMessage().getSOAPEnvelope().getSOAPConstants() != null) {
  -                    SOAPConstants soapConstants = msgContext.getRequestMessage().getSOAPEnvelope().getSOAPConstants();
  -                    msgContext.setSOAPConstants(soapConstants);
  -                }
  -                    
  +                
  +                initSOAPConstants(msgContext);
                   try {
                       h.invoke(msgContext);
                   } catch (AxisFault ae) {
  @@ -338,6 +334,25 @@
       }
   
       /**
  +     * Extract ans store soap constants info from the envelope
  +     * @param msgContext
  +     * @throws AxisFault
  +     */ 
  +    private void initSOAPConstants(MessageContext msgContext) throws AxisFault {
  +        Message msg = msgContext.getRequestMessage();
  +        if (msg == null)
  +            return;
  +        SOAPEnvelope env = msg.getSOAPEnvelope();
  +        if (env == null)
  +            return;
  +        SOAPConstants constants = env.getSOAPConstants();
  +        if (constants == null)
  +            return;
  +        // Ensure that if we get SOAP1.2, then reply using SOAP1.2
  +        msgContext.setSOAPConstants(constants);
  +    }
  +
  +    /**
        *
        */
       public void generateWSDL(MessageContext msgContext) throws AxisFault {