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 ro...@apache.org on 2004/07/01 15:42:49 UTC

cvs commit: ws-axis/c/src/soap HeaderBlock.cpp ComplexElement.cpp SoapHeader.cpp

roshan      2004/07/01 06:42:49

  Modified:    c/include/axis/server HeaderBlock.h ComplexElement.h
                        SoapHeader.h
               c/src/soap HeaderBlock.cpp ComplexElement.cpp SoapHeader.cpp
  Log:
  made changes to deal with null values
  
  Revision  Changes    Path
  1.17      +9 -3      ws-axis/c/include/axis/server/HeaderBlock.h
  
  Index: HeaderBlock.h
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/include/axis/server/HeaderBlock.h,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- HeaderBlock.h	21 Jun 2004 13:14:02 -0000	1.16
  +++ HeaderBlock.h	1 Jul 2004 13:42:48 -0000	1.17
  @@ -157,6 +157,8 @@
      *  NODE_TYPE and value (pachValue) parameters will be usefull.If the type
      *  is ELEMENT_NODE the parameters NODE_TYPE, pachLocalName, pachPrefix, 
      *  pachUri will be usefull.
  +   * The caller of this method has to check the return value and if it is NULL
  +   *  then the operation is not successfull.
      *
      * @param eNODE_TYPE The type of the child to be created, it should be either 
      *  CHARACTER_NODE for CharacterElements or ELEMENT_NODE for 
  @@ -213,14 +215,17 @@
           SOAP_VERSION eSOAP_VERSION);
   
       /**
  -      * Creates a Attribute and adds it to this Header Block.
  +      * Creates a Attribute and adds it to this Header Block. This method might
  +      *  null to indicate unsuccessfull operation. The caller of this method 
  +      *  should check for the return NULL value.
         *
         * @param localname The local name of the attribute.
         * @param prefix The prefix of the attribute.
         * @param uri The namespace uri of the attribute.
         * @param value The value of the attribute.
         *
  -      * @return A pointer to the created Attribute will be returned.
  +      * @return A pointer to the created Attribute will be returned. If the
  +      *  operation is unsuccessfull it will return NULL.
         */
       Attribute* createAttribute(const AxisChar* localname, 
           const AxisChar* prefix, const AxisChar* uri, const AxisChar* value);
  @@ -324,7 +329,8 @@
         *
         * @param pAttribute The Attribute pointer which points to a valid 
         * namespace declartion Attribute.
  -      * @return AXIS_SUCCESS to indicate successfull operation.
  +      * @return AXIS_SUCCESS to indicate successfull operation. AXIS_FAIL to
  +      *  to indicate unsuccessfull operation.
         */
       int addNamespaceDecl(Attribute *pAttribute);
   
  
  
  
  1.2       +2 -1      ws-axis/c/include/axis/server/ComplexElement.h
  
  Index: ComplexElement.h
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/include/axis/server/ComplexElement.h,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ComplexElement.h	14 Jun 2004 14:50:41 -0000	1.1
  +++ ComplexElement.h	1 Jul 2004 13:42:48 -0000	1.2
  @@ -93,7 +93,8 @@
         * Adds the given child node to this Complex Element.
         *
         * @param pBasicNode the child node to be added to this Complex Element.
  -      * @return AXIS_SUCCESS to indicate successfull operation.
  +      * @return AXIS_SUCCESS to indicate successfull operation. Return 
  +      *  AXIS_FAIL to indicate unsuccessfull operation.
         */
       int addChild(BasicNode* pBasicNode);
   
  
  
  
  1.11      +9 -2      ws-axis/c/include/axis/server/SoapHeader.h
  
  Index: SoapHeader.h
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/include/axis/server/SoapHeader.h,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- SoapHeader.h	14 Jun 2004 14:15:34 -0000	1.10
  +++ SoapHeader.h	1 Jul 2004 13:42:48 -0000	1.11
  @@ -47,6 +47,11 @@
    * Added doxygen comments to help autobuild API docs
    */
   
  +/*
  + * Revision 1.2  2004/07/01 roshan
  + * Added doxygen comments to help autobuild API docs
  + */
  +
   typedef enum 
   { 
       HEADER_LEVEL=0, HEADER_BLOCK_LEVEL, HEADER_BLOCK_INSIDE_LEVEL
  @@ -97,7 +102,8 @@
         *
         * @param pAttribute The Attribute pointer which points to a valid 
         * namespace declartion Attribute.
  -      * @return AXIS_SUCCESS to indicate successfull operation.
  +      * @return AXIS_SUCCESS to indicate successfull operation. Return 
  +      *  AXIS_FAIL to indicate unsuccessfull operation.
         */
       int addNamespaceDecl(Attribute* pAttribute);
   
  @@ -105,6 +111,8 @@
         * Adds a Attribute to this Soap Header.
         *
         * @param attr The Attribute to be added.
  +      * @return AXIS_SUCCESS to indicate successfull operation. Return
  +      *  AXIS_FAIL to indicate unsuccessfull operation.
         */
       int addAttribute(Attribute* pAttribute);
       
  @@ -126,7 +134,6 @@
         * The Destructor.
         */
       virtual ~SoapHeader();
  -
   };
   
   #endif 
  
  
  
  1.23      +66 -16    ws-axis/c/src/soap/HeaderBlock.cpp
  
  Index: HeaderBlock.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/soap/HeaderBlock.cpp,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- HeaderBlock.cpp	21 Jun 2004 13:14:02 -0000	1.22
  +++ HeaderBlock.cpp	1 Jul 2004 13:42:48 -0000	1.23
  @@ -23,12 +23,31 @@
    *
    *
    *
  - * @author Roshan Weerasuriya (roshan@jkcs.slt.lk, roshan@opensource.lk)
  + * @author Roshan Weerasuriya (roshanw@jkcsworld.com, roshan@opensource.lk)
    *
    */
   
   /* HeaderBlock.cpp: implementation of the HeaderBlock class. */
   
  +/*
  + * Revision 1.1  2004/07/01 roshan
  + * Added code to "addChild" method to deal with a null child.
  + * Added code to createImmediateChild(NODE_TYPE eNODE_TYPE,
  + *                                            AxisChar *pachLocalName,
  + *                                            AxisChar *pachPrefix,
  + *                                            AxisChar *pachUri,
  + *                                            AxisChar* pachValue)
  + *  to deal with null localname and namespace uri.
  + * Added code to addAttribute(Attribute* pAttr) to deal with null values.
  + * Added code to createAttribute(const AxisChar *localname,
  + *                                        const AxisChar *prefix,
  + *                                       const AxisChar *value)
  + *  to deal with null values.
  + * Added code to addNamespaceDecl(Attribute *pAttribute) to deal with NULL
  + *  null values.
  + */
  +
  +
   #ifdef WIN32
   #pragma warning (disable : 4786)
   #endif
  @@ -54,7 +73,7 @@
       iNoOFChildren = 0;
       m_localname = pachLocalName;
       m_uri = pachUri;
  -	m_sPrefix = "";
  +    m_sPrefix = "";
   }
   
   HeaderBlock::HeaderBlock(const HeaderBlock& rCopy):
  @@ -143,9 +162,12 @@
       m_uri= uri;
   }
   
  -void HeaderBlock::addAttribute(Attribute* attr)
  +void HeaderBlock::addAttribute(Attribute* pAttr)
   {
  -    m_attributes.push_back(attr);
  +    if (pAttr)
  +    {
  +        m_attributes.push_back(pAttr);
  +    }
   }
   
   int HeaderBlock::serialize(SoapSerializer& pSZ)
  @@ -273,10 +295,17 @@
   
   int HeaderBlock::addChild(BasicNode *pBasicNode)
   {
  -    m_children.push_back(pBasicNode);
  -    iNoOFChildren++;
  +    if (pBasicNode)
  +    {
  +        m_children.push_back(pBasicNode);
  +        iNoOFChildren++;
   
  -    return AXIS_SUCCESS;
  +        return AXIS_SUCCESS;
  +    }
  +    else
  +    {
  +        return AXIS_FAIL;
  +    }
   }
   
   int HeaderBlock::serializeChildren(SoapSerializer& pSZ,
  @@ -303,9 +332,15 @@
   
   int HeaderBlock::addNamespaceDecl(Attribute *pAttribute)
   {
  -    m_namespaceDecls.push_back(pAttribute);
  -
  -    return AXIS_SUCCESS;
  +    if (pAttribute)
  +    {
  +        m_namespaceDecls.push_back(pAttribute);
  +        return AXIS_SUCCESS;
  +    }
  +    else
  +    {
  +        return AXIS_FAIL;
  +    }
   }
   
   int HeaderBlock::serializeNamespaceDecl(SoapSerializer &pSZ)
  @@ -456,8 +491,13 @@
                                           const AxisChar *prefix,
                                           const AxisChar *value)
   {
  -    Attribute* pAttribute = new Attribute(localname, prefix, value);
  -    m_attributes.push_back(pAttribute);
  +    Attribute* pAttribute = 0;
  +
  +    if (localname)
  +    {
  +        Attribute* pAttribute = new Attribute(localname, prefix, value);
  +        m_attributes.push_back(pAttribute);
  +    }
   
       return pAttribute;
   }
  @@ -583,16 +623,26 @@
           }
           else if (eNODE_TYPE==ELEMENT_NODE)
           {
  -            pBasicNode = new ComplexElement(pachLocalName, pachPrefix,
  -                pachUri);
  +            if ( (pachLocalName) && (pachUri) )
  +            {
  +                pBasicNode = new ComplexElement(pachLocalName, pachPrefix,
  +                    pachUri);
  +            }
  +            else
  +            {
  +                break;
  +            }
           }
           else
           {
               break;
           }
   
  -        m_children.push_back(pBasicNode);
  -        iNoOFChildren++;
  +        if (pBasicNode)
  +        {
  +            m_children.push_back(pBasicNode);
  +            iNoOFChildren++;
  +        }
       } while (0);
   
       return pBasicNode;
  
  
  
  1.17      +17 -4     ws-axis/c/src/soap/ComplexElement.cpp
  
  Index: ComplexElement.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/soap/ComplexElement.cpp,v
  retrieving revision 1.16
  retrieving revision 1.17
  diff -u -r1.16 -r1.17
  --- ComplexElement.cpp	1 Jun 2004 09:00:55 -0000	1.16
  +++ ComplexElement.cpp	1 Jul 2004 13:42:48 -0000	1.17
  @@ -23,7 +23,7 @@
    *
    *
    *
  - * @author Roshan Weerasuriya (roshan@jkcs.slt.lk, roshan@opensource.lk)
  + * @author Roshan Weerasuriya (roshanw@jkcsworld.com, roshan@opensource.lk)
    * @author Samisa Abeysinghe (sabeysinghe@virtusa.com)
    *
    */
  @@ -33,6 +33,12 @@
    * Added copy constructure and clone for copy constructing derived classes
    */
   
  +/*
  + * Revision 1.2  2004/07/01 roshan
  + * Added code to addChild(BasicNode *pBasicNode) method to deal with NULL
  + *  values.
  + */
  +
   /* ComplexElement.cpp: implementation of the ComplexElement class. */
   
   
  @@ -123,9 +129,16 @@
   
   int ComplexElement::addChild(BasicNode *pBasicNode)
   {
  -    m_children.push_back(pBasicNode);
  -    iNoOfChildren++;
  -    return AXIS_SUCCESS;
  +    if (pBasicNode)
  +    {
  +        m_children.push_back(pBasicNode);
  +        iNoOfChildren++;
  +        return AXIS_SUCCESS;
  +    }
  +    else
  +    {
  +        return AXIS_FAIL;
  +    }
   }
   
   int ComplexElement::serialize(SoapSerializer& pSZ)
  
  
  
  1.20      +32 -7     ws-axis/c/src/soap/SoapHeader.cpp
  
  Index: SoapHeader.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/src/soap/SoapHeader.cpp,v
  retrieving revision 1.19
  retrieving revision 1.20
  diff -u -r1.19 -r1.20
  --- SoapHeader.cpp	14 Jun 2004 14:15:34 -0000	1.19
  +++ SoapHeader.cpp	1 Jul 2004 13:42:49 -0000	1.20
  @@ -15,7 +15,15 @@
    */
   
   /*
  - * @author Roshan Weerasuriya (roshan@jkcs.slt.lk, roshan@opensource.lk)
  + * @author Roshan Weerasuriya (roshanw@jkcsworld.com, roshan@opensource.lk)
  + */
  +
  +/*
  + * Revision 1.1 2004/07/01 roshan
  + * Added code to the following methods to deal with NULL values.
  + *  addNamespaceDecl(Attribute *pAttribute)
  + *  addAttribute(Attribute *pAttribute)
  + *  addHeaderBlock(HeaderBlock* pHeaderBlock)
    */
   
   #ifdef WIN32
  @@ -60,9 +68,12 @@
       m_attributes.clear();
   }
   
  -void SoapHeader::addHeaderBlock(HeaderBlock* headerBlock)
  +void SoapHeader::addHeaderBlock(HeaderBlock* pHeaderBlock)
   {
  -    m_headerBlocks.push_back(headerBlock);
  +    if (pHeaderBlock)
  +    {
  +        m_headerBlocks.push_back(pHeaderBlock);
  +    }
   }
   
   int SoapHeader::serialize(SoapSerializer& pSZ, SOAP_VERSION eSoapVersion)
  @@ -115,9 +126,16 @@
   
   int SoapHeader::addAttribute(Attribute *pAttribute)
   {
  -    m_attributes.push_back(pAttribute);
  +    if (pAttribute)
  +    {
  +        m_attributes.push_back(pAttribute);
   
  -    return AXIS_SUCCESS;
  +        return AXIS_SUCCESS;
  +    }
  +    else
  +    {
  +        return AXIS_FAIL;
  +    }
   }
   
   
  @@ -136,9 +154,16 @@
   
   int SoapHeader::addNamespaceDecl(Attribute *pAttribute)
   {
  -    m_namespaceDecls.push_back(pAttribute);
  +    if (pAttribute)
  +    {
  +        m_namespaceDecls.push_back(pAttribute);
   
  -    return AXIS_SUCCESS;
  +        return AXIS_SUCCESS;
  +    }
  +    else
  +    {
  +        return AXIS_FAIL;
  +    }
   }
   
   int SoapHeader::serializeNamespaceDecl(SoapSerializer& pSZ)