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 na...@apache.org on 2006/03/08 07:11:46 UTC
svn commit: r384128 - in /webservices/axis2/trunk/c: include/
modules/xml/om/ test/xml/soap/
Author: nandika
Date: Tue Mar 7 22:11:44 2006
New Revision: 384128
URL: http://svn.apache.org/viewcvs?rev=384128&view=rev
Log:
old error handling macros removed with new ones , set_last_child function removed from om node
Modified:
webservices/axis2/trunk/c/include/axis2_error.h
webservices/axis2/trunk/c/include/axis2_om_child_element_iterator.h
webservices/axis2/trunk/c/include/axis2_om_node.h
webservices/axis2/trunk/c/modules/xml/om/om_attribute.c
webservices/axis2/trunk/c/modules/xml/om/om_child_element_iterator.c
webservices/axis2/trunk/c/modules/xml/om/om_children_iterator.c
webservices/axis2/trunk/c/modules/xml/om/om_children_qname_iterator.c
webservices/axis2/trunk/c/modules/xml/om/om_children_with_specific_attribute_iterator.c
webservices/axis2/trunk/c/modules/xml/om/om_comment.c
webservices/axis2/trunk/c/modules/xml/om/om_node.c
webservices/axis2/trunk/c/test/xml/soap/test_soap.c
Modified: webservices/axis2/trunk/c/include/axis2_error.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_error.h?rev=384128&r1=384127&r2=384128&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_error.h (original)
+++ webservices/axis2/trunk/c/include/axis2_error.h Tue Mar 7 22:11:44 2006
@@ -227,39 +227,39 @@
AXIS2_ERROR_SERVICE_MODULE_CAN_NOT_REFER_GLOBAL_PHASE,
AXIS2_ERROR_INVALID_PHASE,
-
+ /** error occured in writing start element in xml writer */
AXIS2_ERROR_WRITING_START_ELEMENT,
-
+ /** error occured in writing start element in start document in xml writer */
AXIS2_ERROR_WRITING_START_DOCUMENT,
-
+ /** error occured in writing end element in xml writer */
AXIS2_ERROR_WRITING_END_ELEMENT,
-
+ /** error occured in writing end document in xml writer */
AXIS2_ERROR_WRITING_END_DOCUMENT,
-
+ /** error occured in writing start element with namespace in xml writer*/
AXIS2_ERROR_WRITING_START_ELEMENT_WITH_NAMESPACE,
-
+ /** error occured in writing start element with namespace prefix */
AXIS2_ERROR_WRITING_START_ELEMENT_WITH_NAMESPACE_PREFIX,
-
+ /** error occured in writing empty element */
AXIS2_ERROR_WRITING_EMPTY_ELEMENT,
-
+ /** error occured in writing empty element with namespace */
AXIS2_ERROR_WRITING_EMPTY_ELEMENT_WITH_NAMESPACE,
-
+ /** error in writing empty element with namespace prefix */
AXIS2_ERROR_WRITING_EMPTY_ELEMENT_WITH_NAMESPACE_PREFIX,
-
+ /** error in writing attribute */
AXIS2_ERROR_WRITING_ATTRIBUTE,
-
+ /** error in writing attribute with namespace */
AXIS2_ERROR_WRITING_ATTRIBUTE_WITH_NAMESPACE,
-
+ /** error in writing attribute with namespace prefix */
AXIS2_ERROR_WRITING_ATTRIBUTE_WITH_NAMESPACE_PREFIX,
-
+ /** error in writing comment */
AXIS2_ERROR_WRITING_COMMENT,
-
+ /** error in writing processing instruction */
AXIS2_ERROR_WRITING_PROCESSING_INSTRUCTION,
-
+ /** error in writing cdata section */
AXIS2_ERROR_WTRING_CDATA,
-
+ /** error in writing dtd */
AXIS2_ERROR_WRITING_DTD,
-
+ /** error in writing default namespace */
AXIS2_ERROR_WRITING_DEFAULT_NAMESPACE,
/**Two service can not have same name, a service with same name alredy
* exist in the system
@@ -376,20 +376,21 @@
AXIS2_ERROR_INVALID_MODULE_CONF,
AXIS2_ERROR_SOAP_MESSAGE_FIRST_ELEMENT_MUST_CONTAIN_LOCAL_NAME,
-
+ /** soap builder encountered multiple headers */
AXIS2_ERROR_SOAP_BUILDER_MULTIPLE_HEADERS_ENCOUNTERED,
-
+ /** soap builder encounterd body element first and header next */
AXIS2_ERROR_SOAP_BUILDER_HEADER_BODY_WRONG_ORDER,
-
+ /** soap builder multiple body elements encounterd */
AXIS2_ERROR_SOAP_BUILDER_MULTIPLE_BODY_ELEMENTS_ENCOUNTERED,
-
+ /** soap builder found a child element other than header or body in envelope
+ element */
AXIS2_ERROR_SOAP_BUILDER_ENVELOPE_CAN_HAVE_ONLY_HEADER_AND_BODY,
/* Invalid messge addition , operation context completed */
AXIS2_ERROR_INVALID_MESSAGE_ADDITION,
-
+ /** invalid soap namespace uri found */
AXIS2_ERROR_INVALID_SOAP_NAMESPACE_URI,
-
+ /** soap message does not have an envelope element */
AXIS2_ERROR_SOAP_MESSAGE_DOES_NOT_CONTAIN_AN_ENVELOPE,
AXIS2_ERROR_TRANSPORT_LEVEL_INFORMATION_DOES_NOT_MATCH_WITH_SOAP,
@@ -434,7 +435,13 @@
AXIS2_ERROR_ROLE_ELEMENT_SHOULD_HAVE_A_TEXT,
AXIS2_ERROR_SOAP11_FAULT_ACTOR_SHOULD_NOT_HAVE_CHILD_ELEMENTS,
-
+ /** next method has not been called so cannot remove
+ an element before calling next valid for any om iterator */
+ AXIS2_ERROR_ITERATOR_NEXT_METHOD_HAS_NOT_YET_BEEN_CALLED,
+ /** remove method has alread been called once so cann't remove till
+ next method is called valid for any om children iterator*/
+ AXIS2_ERROR_ITERATOR_REMOVE_HAS_ALREADY_BEING_CALLED,
+
/* OM output is NULL */
AXIS2_ERROR_NULL_OM_OUTPUT,
/* We got a NULL strem in the response body */
Modified: webservices/axis2/trunk/c/include/axis2_om_child_element_iterator.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_om_child_element_iterator.h?rev=384128&r1=384127&r2=384128&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_om_child_element_iterator.h (original)
+++ webservices/axis2/trunk/c/include/axis2_om_child_element_iterator.h Tue Mar 7 22:11:44 2006
@@ -112,8 +112,7 @@
#define AXIS2_OM_CHILD_ELEMENT_ITERATOR_NEXT(iterator, env) \
((iterator)->ops->next(iterator, env))
-
- /** @} */
+/** @} */
#ifdef __cplusplus
}
Modified: webservices/axis2/trunk/c/include/axis2_om_node.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_om_node.h?rev=384128&r1=384127&r2=384128&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_om_node.h (original)
+++ webservices/axis2/trunk/c/include/axis2_om_node.h Tue Mar 7 22:11:44 2006
@@ -256,19 +256,7 @@
(axis2_om_node_t *om_node,
axis2_env_t **env,
axis2_om_node_t *first_child);
- /**
- * set last child
- * @param om_node
- * @param env environment, MUST NOT be NULL.
- * @param last_child
- * @return status code AXIS2_SUCCESS on success.AXIS2_FAILURE on error
- *
- */
- axis2_status_t (AXIS2_CALL *set_last_child)
- (axis2_om_node_t *om_node,
- axis2_env_t **env,
- axis2_om_node_t *last_child);
- /**
+ /**
* set next sibling
* @param om_node
* @param env environment, MUST NOT be NULL.
@@ -431,9 +419,7 @@
/** node type one of om_node_types */
#define AXIS2_OM_NODE_GET_NODE_TYPE(om_node,env) \
((om_node)->ops->get_node_type(om_node,env))
-/*** set last child */
-#define AXIS2_OM_NODE_SET_LAST_CHILD(om_node,env,last_child) \
- ((om_node)->ops->set_last_child(om_node,env,last_child))
+
/** set first child */
#define AXIS2_OM_NODE_SET_FIRST_CHILD(om_node,env,first_child)\
((om_node)->ops->set_first_child(om_node,env,first_child))
Modified: webservices/axis2/trunk/c/modules/xml/om/om_attribute.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/om/om_attribute.c?rev=384128&r1=384127&r2=384128&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/om_attribute.c (original)
+++ webservices/axis2/trunk/c/modules/xml/om/om_attribute.c Tue Mar 7 22:11:44 2006
@@ -87,77 +87,78 @@
const axis2_char_t * value,
axis2_om_namespace_t * ns)
{
- axis2_om_attribute_impl_t *attribute = NULL;
+ axis2_om_attribute_impl_t *attribute_impl = NULL;
AXIS2_ENV_CHECK(env, NULL);
- if (!localname)
- { /* localname is mandatory */
- AXIS2_ERROR_SET_ERROR_NUMBER((*env)->error,
- AXIS2_ERROR_INVALID_NULL_PARAM);
- AXIS2_ERROR_SET_STATUS_CODE((*env)->error, AXIS2_FAILURE);
- return NULL;
- }
-
- attribute = (axis2_om_attribute_impl_t *) AXIS2_MALLOC ((*env)->allocator,
+ /* localname is mandatory */
+ AXIS2_FUNC_PARAM_CHECK(localname, env, NULL);
+
+ attribute_impl = (axis2_om_attribute_impl_t *) AXIS2_MALLOC ((*env)->allocator,
sizeof (axis2_om_attribute_impl_t));
- if (!attribute)
+ if (!attribute_impl)
{
- AXIS2_ERROR_SET_ERROR_NUMBER((*env)->error , AXIS2_ERROR_NO_MEMORY);
- AXIS2_ERROR_SET_STATUS_CODE((*env)->error, AXIS2_FAILURE);
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
return NULL;
}
/** initialize fields */
- attribute->localname =(axis2_char_t*) AXIS2_STRDUP(localname,env);
- if (!(attribute->localname))
+ attribute_impl->localname = NULL;
+ attribute_impl->value = NULL;
+ attribute_impl->ns = NULL;
+ attribute_impl->om_attribute.ops = NULL;
+ attribute_impl->qname = NULL;
+
+ attribute_impl->localname =(axis2_char_t*) AXIS2_STRDUP(localname,env);
+ if (!(attribute_impl->localname))
{
- AXIS2_FREE ((*env)->allocator, attribute);
- AXIS2_ERROR_SET_ERROR_NUMBER((*env)->error, AXIS2_ERROR_NO_MEMORY);
- AXIS2_ERROR_SET_STATUS_CODE((*env)->error, AXIS2_FAILURE);
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ AXIS2_FREE ((*env)->allocator, attribute_impl);
return NULL;
}
- attribute->value =(axis2_char_t*) AXIS2_STRDUP (value,env);
- if (!(attribute->value))
+ if(NULL != value)
{
- AXIS2_FREE ((*env)->allocator, attribute->localname);
- AXIS2_FREE ((*env)->allocator, attribute);
- AXIS2_ERROR_SET_ERROR_NUMBER((*env)->error, AXIS2_ERROR_NO_MEMORY);
- AXIS2_ERROR_SET_STATUS_CODE((*env)->error, AXIS2_FAILURE);
- return NULL;
+ attribute_impl->value =(axis2_char_t*) AXIS2_STRDUP (value,env);
+ if (!(attribute_impl->value))
+ {
+ AXIS2_ERROR_SET((*env)->error , AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ AXIS2_FREE ((*env)->allocator, attribute_impl->localname);
+ AXIS2_FREE ((*env)->allocator, attribute_impl);
+ return NULL;
+ }
}
- attribute->ns = ns;
+ attribute_impl->ns = ns;
- /** ops */
- attribute->qname = NULL;
- attribute->om_attribute.ops = (axis2_om_attribute_ops_t*)AXIS2_MALLOC ((*env)->allocator,
- sizeof (axis2_om_attribute_ops_t));
- if (!(attribute->om_attribute.ops))
- {
- AXIS2_FREE ((*env)->allocator, attribute->value);
- AXIS2_FREE ((*env)->allocator, attribute->localname);
- AXIS2_FREE ((*env)->allocator, attribute);
- AXIS2_ERROR_SET_ERROR_NUMBER((*env)->error, AXIS2_ERROR_NO_MEMORY);
- AXIS2_ERROR_SET_STATUS_CODE((*env)->error, AXIS2_FAILURE);
+ attribute_impl->om_attribute.ops = (axis2_om_attribute_ops_t*)AXIS2_MALLOC(
+ (*env)->allocator,
+ sizeof (axis2_om_attribute_ops_t));
+
+ if (!(attribute_impl->om_attribute.ops))
+ {
+ AXIS2_FREE ((*env)->allocator, attribute_impl->value);
+ AXIS2_FREE ((*env)->allocator, attribute_impl->localname);
+ AXIS2_FREE ((*env)->allocator, attribute_impl);
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
return NULL;
}
- attribute->om_attribute.ops->free = axis2_om_attribute_free;
- attribute->om_attribute.ops->get_qname = axis2_om_attribute_get_qname;
- attribute->om_attribute.ops->serialize = axis2_om_attribute_serialize;
-
- attribute->om_attribute.ops->get_localname = axis2_om_attribute_get_localname;
- attribute->om_attribute.ops->get_value = axis2_om_attribute_get_value;
- attribute->om_attribute.ops->get_namespace = axis2_om_attribute_get_namespace;
-
- attribute->om_attribute.ops->set_localname = axis2_om_attribute_set_localname;
- attribute->om_attribute.ops->set_namespace = axis2_om_attribute_set_namespace;
- attribute->om_attribute.ops->set_value = axis2_om_attribute_set_value;
+
+ attribute_impl->om_attribute.ops->free = axis2_om_attribute_free;
+ attribute_impl->om_attribute.ops->get_qname = axis2_om_attribute_get_qname;
+ attribute_impl->om_attribute.ops->serialize = axis2_om_attribute_serialize;
+
+ attribute_impl->om_attribute.ops->get_localname = axis2_om_attribute_get_localname;
+ attribute_impl->om_attribute.ops->get_value = axis2_om_attribute_get_value;
+ attribute_impl->om_attribute.ops->get_namespace = axis2_om_attribute_get_namespace;
+
+ attribute_impl->om_attribute.ops->set_localname = axis2_om_attribute_set_localname;
+ attribute_impl->om_attribute.ops->set_namespace = axis2_om_attribute_set_namespace;
+ attribute_impl->om_attribute.ops->set_value = axis2_om_attribute_set_value;
- return &(attribute->om_attribute);
+ return &(attribute_impl->om_attribute);
}
axis2_status_t AXIS2_CALL
axis2_om_attribute_free (axis2_om_attribute_t *om_attribute,
- axis2_env_t **env)
+ axis2_env_t **env)
{
axis2_om_attribute_impl_t *attribute_impl = NULL;
@@ -222,14 +223,7 @@
AXIS2_ENV_CHECK(env,AXIS2_FAILURE);
-
- if (!om_output)
- {
- AXIS2_ERROR_SET_ERROR_NUMBER((*env)->error, AXIS2_ERROR_INVALID_NULL_PARAM);
- AXIS2_ERROR_SET_STATUS_CODE((*env)->error, AXIS2_FAILURE);
- return AXIS2_FAILURE;
- }
-
+ AXIS2_FUNC_PARAM_CHECK(om_output, env, AXIS2_FAILURE);
attribute = AXIS2_INTF_TO_IMPL(om_attribute);
if (attribute->ns && AXIS2_OM_NAMESPACE_GET_URI(attribute->ns,env) &&
@@ -287,14 +281,25 @@
axis2_env_t **env,
const axis2_char_t *localname)
{
+ axis2_om_attribute_impl_t *attr_impl = NULL;
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- if(!localname)
+ AXIS2_FUNC_PARAM_CHECK(localname, env, AXIS2_FAILURE);
+ attr_impl = AXIS2_INTF_TO_IMPL(om_attribute);
+
+ if(NULL != (attr_impl->localname))
+ {
+ AXIS2_FREE((*env)->allocator, attr_impl->localname);
+ attr_impl->localname = NULL;
+ }
+
+ attr_impl->localname = (axis2_char_t*)AXIS2_STRDUP(localname,env);
+
+ if(!(attr_impl->localname))
{
- AXIS2_ERROR_SET_ERROR_NUMBER((*env)->error, AXIS2_ERROR_INVALID_NULL_PARAM);
- AXIS2_ERROR_SET_STATUS_CODE((*env)->error, AXIS2_FAILURE);
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
return AXIS2_FAILURE;
}
- AXIS2_INTF_TO_IMPL(om_attribute)->localname = (axis2_char_t*)AXIS2_STRDUP(localname,env);
+
return AXIS2_SUCCESS;
}
@@ -303,14 +308,22 @@
axis2_env_t **env,
const axis2_char_t *value)
{
+ axis2_om_attribute_impl_t *attr_impl = NULL;
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- if(!value)
+ AXIS2_FUNC_PARAM_CHECK(value, env, AXIS2_FAILURE);
+ attr_impl = AXIS2_INTF_TO_IMPL(om_attribute);
+ if(NULL != attr_impl->value)
+ {
+ AXIS2_FREE((*env)->allocator, attr_impl->value);
+ attr_impl->value = NULL;
+ }
+
+ attr_impl->value = (axis2_char_t*)AXIS2_STRDUP(value, env);
+ if(!(attr_impl->value))
{
- AXIS2_ERROR_SET_ERROR_NUMBER((*env)->error, AXIS2_ERROR_INVALID_NULL_PARAM);
- AXIS2_ERROR_SET_STATUS_CODE((*env)->error, AXIS2_FAILURE);
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
return AXIS2_FAILURE;
}
- AXIS2_INTF_TO_IMPL(om_attribute)->value = (axis2_char_t*)AXIS2_STRDUP(value,env);
return AXIS2_SUCCESS;
}
@@ -320,12 +333,7 @@
axis2_om_namespace_t *om_namespace)
{
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- if(!om_namespace)
- {
- AXIS2_ERROR_SET_ERROR_NUMBER((*env)->error, AXIS2_ERROR_INVALID_NULL_PARAM);
- AXIS2_ERROR_SET_STATUS_CODE((*env)->error, AXIS2_FAILURE);
- return AXIS2_FAILURE;
- }
+ AXIS2_FUNC_PARAM_CHECK(om_namespace, env, AXIS2_FAILURE);
AXIS2_INTF_TO_IMPL(om_attribute)->ns = om_namespace;
return AXIS2_SUCCESS;
}
Modified: webservices/axis2/trunk/c/modules/xml/om/om_child_element_iterator.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/om/om_child_element_iterator.c?rev=384128&r1=384127&r2=384128&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/om_child_element_iterator.c (original)
+++ webservices/axis2/trunk/c/modules/xml/om/om_child_element_iterator.c Tue Mar 7 22:11:44 2006
@@ -124,6 +124,7 @@
(axis2_om_child_element_iterator_t *iterator,
axis2_env_t **env)
{
+ axis2_om_node_t *last_child = NULL;
axis2_om_child_element_iterator_impl_t *iterator_impl = NULL;
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
iterator_impl = AXIS2_INTF_TO_IMPL(iterator);
@@ -137,7 +138,8 @@
if(!(iterator_impl->last_child))
return AXIS2_FAILURE;
- AXIS2_OM_NODE_DETACH(iterator_impl->last_child, env);
+ last_child = AXIS2_OM_NODE_DETACH(iterator_impl->last_child, env);
+ AXIS2_OM_NODE_FREE_TREE(last_child, env);
return AXIS2_SUCCESS;
}
@@ -150,7 +152,7 @@
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
iterator_impl = AXIS2_INTF_TO_IMPL(iterator);
- return iterator_impl->current_child ? AXIS2_TRUE : AXIS2_FALSE;
+ return (iterator_impl->current_child) ? AXIS2_TRUE : AXIS2_FALSE;
}
axis2_om_node_t* AXIS2_CALL
Modified: webservices/axis2/trunk/c/modules/xml/om/om_children_iterator.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/om/om_children_iterator.c?rev=384128&r1=384127&r2=384128&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/om_children_iterator.c (original)
+++ webservices/axis2/trunk/c/modules/xml/om/om_children_iterator.c Tue Mar 7 22:11:44 2006
@@ -115,19 +115,31 @@
axis2_env_t **env)
{
axis2_om_children_iterator_impl_t *iterator_impl = NULL;
+ axis2_om_node_t *om_node = NULL;
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
iterator_impl = AXIS2_INTF_TO_IMPL(iterator);
if(!(iterator_impl->next_called))
+ {
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_ITERATOR_NEXT_METHOD_HAS_NOT_YET_BEEN_CALLED, AXIS2_FAILURE);
return AXIS2_FAILURE;
- if(iterator_impl->remove_called)
+ }
+ if(iterator_impl->remove_called)
+ {
+ AXIS2_ERROR_SET((*env)->error,
+ AXIS2_ERROR_ITERATOR_REMOVE_HAS_ALREADY_BEING_CALLED, AXIS2_FAILURE);
return AXIS2_FAILURE;
-
+ }
iterator_impl->remove_called = AXIS2_TRUE;
if(!(iterator_impl->last_child))
return AXIS2_FAILURE;
- AXIS2_OM_NODE_DETACH(iterator_impl->last_child, env);
+ om_node = AXIS2_OM_NODE_DETACH(iterator_impl->last_child, env);
+ if(om_node)
+ {
+ AXIS2_OM_NODE_FREE_TREE(om_node, env);
+ om_node = NULL;
+ }
return AXIS2_SUCCESS;
}
@@ -139,7 +151,7 @@
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
iterator_impl = AXIS2_INTF_TO_IMPL(iterator);
- return iterator_impl->current_child ? AXIS2_TRUE : AXIS2_FALSE;
+ return (iterator_impl->current_child) ? AXIS2_TRUE : AXIS2_FALSE;
}
axis2_om_node_t* AXIS2_CALL
Modified: webservices/axis2/trunk/c/modules/xml/om/om_children_qname_iterator.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/om/om_children_qname_iterator.c?rev=384128&r1=384127&r2=384128&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/om_children_qname_iterator.c (original)
+++ webservices/axis2/trunk/c/modules/xml/om/om_children_qname_iterator.c Tue Mar 7 22:11:44 2006
@@ -150,19 +150,32 @@
axis2_env_t **env)
{
axis2_om_children_qname_iterator_impl_t *iterator_impl = NULL;
+ axis2_om_node_t *last_child = NULL;
AXIS2_ENV_CHECK( env, AXIS2_FAILURE);
iterator_impl = AXIS2_INTF_TO_IMPL(iterator);
if(!(iterator_impl->next_called))
+ {
+ AXIS2_ERROR_SET((*env)->error,
+ AXIS2_ERROR_ITERATOR_NEXT_METHOD_HAS_NOT_YET_BEEN_CALLED, AXIS2_FAILURE);
return AXIS2_FAILURE;
- if(iterator_impl->remove_called)
+ }
+ if(iterator_impl->remove_called)
+ {
+ AXIS2_ERROR_SET((*env)->error,
+ AXIS2_ERROR_ITERATOR_REMOVE_HAS_ALREADY_BEING_CALLED, AXIS2_FAILURE);
return AXIS2_FAILURE;
-
+ }
iterator_impl->remove_called = AXIS2_TRUE;
if(!(iterator_impl->last_child))
return AXIS2_FAILURE;
- AXIS2_OM_NODE_DETACH(iterator_impl->last_child, env);
+ last_child = AXIS2_OM_NODE_DETACH(iterator_impl->last_child, env);
+ if(last_child)
+ {
+ AXIS2_OM_NODE_FREE_TREE(last_child, env);
+ last_child = NULL;
+ }
return AXIS2_SUCCESS;
}
@@ -233,7 +246,11 @@
iterator_impl->remove_called = AXIS2_FALSE;
iterator_impl->last_child = iterator_impl->current_child;
- iterator_impl->current_child = AXIS2_OM_NODE_GET_NEXT_SIBLING(iterator_impl->current_child, env);
+ if(iterator_impl->current_child)
+ {
+ iterator_impl->current_child =
+ AXIS2_OM_NODE_GET_NEXT_SIBLING(iterator_impl->current_child, env);
+ }
return iterator_impl->last_child;
}
Modified: webservices/axis2/trunk/c/modules/xml/om/om_children_with_specific_attribute_iterator.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/om/om_children_with_specific_attribute_iterator.c?rev=384128&r1=384127&r2=384128&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/om_children_with_specific_attribute_iterator.c (original)
+++ webservices/axis2/trunk/c/modules/xml/om/om_children_with_specific_attribute_iterator.c Tue Mar 7 22:11:44 2006
@@ -128,11 +128,20 @@
axis2_om_children_with_specific_attribute_iterator_t *iterator,
axis2_env_t **env)
{
+ axis2_om_children_with_specific_attribute_iterator_impl_t *qname_iter_impl = NULL;
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ qname_iter_impl = AXIS2_INTF_TO_IMPL(iterator);
+ if(qname_iter_impl->attr_qname)
+ {
+ AXIS2_QNAME_FREE(qname_iter_impl->attr_qname, env);
+ qname_iter_impl->attr_qname = NULL;
+ }
if(iterator->ops)
+ {
AXIS2_FREE((*env)->allocator, iterator->ops);
-
- AXIS2_FREE((*env)->allocator, AXIS2_INTF_TO_IMPL(iterator));
+ iterator->ops = NULL;
+ }
+ AXIS2_FREE((*env)->allocator, qname_iter_impl);
return AXIS2_SUCCESS;
}
@@ -142,19 +151,32 @@
axis2_env_t **env)
{
axis2_om_children_with_specific_attribute_iterator_impl_t *iterator_impl = NULL;
+ axis2_om_node_t *last_child = NULL;
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
iterator_impl = AXIS2_INTF_TO_IMPL(iterator);
if(!(iterator_impl->next_called))
+ {
+ AXIS2_ERROR_SET((*env)->error,
+ AXIS2_ERROR_ITERATOR_NEXT_METHOD_HAS_NOT_YET_BEEN_CALLED, AXIS2_FAILURE);
return AXIS2_FAILURE;
- if(iterator_impl->remove_called)
+ }
+ if(iterator_impl->remove_called)
+ {
+ AXIS2_ERROR_SET((*env)->error,
+ AXIS2_ERROR_ITERATOR_REMOVE_HAS_ALREADY_BEING_CALLED, AXIS2_FAILURE);
return AXIS2_FAILURE;
-
+ }
iterator_impl->remove_called = AXIS2_TRUE;
if(!(iterator_impl->last_child))
return AXIS2_FAILURE;
- AXIS2_OM_NODE_DETACH(iterator_impl->last_child, env);
+ last_child = AXIS2_OM_NODE_DETACH(iterator_impl->last_child, env);
+ if(last_child)
+ {
+ AXIS2_OM_NODE_FREE_TREE(last_child, env);
+ last_child = NULL;
+ }
return AXIS2_SUCCESS;
}
@@ -198,7 +220,7 @@
iterator_impl->current_child =
AXIS2_OM_NODE_GET_NEXT_SIBLING(
iterator_impl->current_child, env);
- need_to_move_forward = iterator_impl->current_child != NULL;
+ need_to_move_forward = (iterator_impl->current_child != NULL);
}
}
@@ -221,6 +243,7 @@
axis2_env_t **env)
{
axis2_om_children_with_specific_attribute_iterator_impl_t *iterator_impl = NULL;
+ axis2_om_node_t *last_child = NULL;
AXIS2_ENV_CHECK(env, NULL);
iterator_impl = AXIS2_INTF_TO_IMPL(iterator);
@@ -232,7 +255,9 @@
if(iterator_impl->last_child && iterator_impl->detach
&& (AXIS2_OM_NODE_GET_PARENT(iterator_impl->last_child, env)))
{
- AXIS2_OM_NODE_DETACH(iterator_impl->last_child, env);
+ last_child = AXIS2_OM_NODE_DETACH(iterator_impl->last_child, env);
+ if(last_child)
+ AXIS2_OM_NODE_FREE_TREE(last_child, env);
}
return iterator_impl->last_child;
}
Modified: webservices/axis2/trunk/c/modules/xml/om/om_comment.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/om/om_comment.c?rev=384128&r1=384127&r2=384128&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/om_comment.c (original)
+++ webservices/axis2/trunk/c/modules/xml/om/om_comment.c Tue Mar 7 22:11:44 2006
@@ -57,11 +57,10 @@
axis2_om_node_t ** node)
{
axis2_om_comment_impl_t *comment = NULL;
- *node = NULL;
AXIS2_ENV_CHECK(env, NULL);
AXIS2_PARAM_CHECK((*env)->error, value, NULL);
AXIS2_PARAM_CHECK((*env)->error, node, NULL);
-
+ *node = NULL;
*node = axis2_om_node_create (env);
if (!*node)
{
@@ -132,6 +131,7 @@
if (comment_impl->value)
{
AXIS2_FREE ((*env)->allocator, comment_impl->value);
+ comment_impl->value = NULL;
}
AXIS2_FREE((*env)->allocator, om_comment->ops);
AXIS2_FREE((*env)->allocator,comment_impl);
@@ -153,8 +153,15 @@
axis2_env_t **env,
const axis2_char_t *value)
{
+ axis2_om_comment_impl_t *comment_impl = NULL;
AXIS2_ENV_CHECK( env, AXIS2_FAILURE);
AXIS2_PARAM_CHECK((*env)->error, value, AXIS2_FAILURE);
+ comment_impl = AXIS2_INTF_TO_IMPL(om_comment);
+ if(comment_impl->value)
+ {
+ AXIS2_FREE((*env)->allocator, comment_impl->value);
+ comment_impl->value = NULL;
+ }
AXIS2_INTF_TO_IMPL(om_comment)->value = (axis2_char_t*)AXIS2_STRDUP(value,env);
return AXIS2_SUCCESS;
}
@@ -168,8 +175,8 @@
AXIS2_ENV_CHECK( env, AXIS2_FAILURE);
AXIS2_PARAM_CHECK((*env)->error, om_output, AXIS2_FAILURE);
-
comment_impl = AXIS2_INTF_TO_IMPL(om_comment);
+
if(comment_impl->value)
return axis2_om_output_write(om_output, env,
AXIS2_OM_COMMENT , 1 , comment_impl->value);
Modified: webservices/axis2/trunk/c/modules/xml/om/om_node.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/om/om_node.c?rev=384128&r1=384127&r2=384128&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/om/om_node.c (original)
+++ webservices/axis2/trunk/c/modules/xml/om/om_node.c Tue Mar 7 22:11:44 2006
@@ -107,10 +107,6 @@
axis2_env_t **env,
axis2_om_node_t *first_child);
-axis2_status_t AXIS2_CALL
-axis2_om_node_set_last_child(axis2_om_node_t *om_node,
- axis2_env_t **env,
- axis2_om_node_t *last_child);
axis2_status_t AXIS2_CALL
axis2_om_node_set_previous_sibling(axis2_om_node_t *om_node,
@@ -256,11 +252,9 @@
node->om_node.ops->set_data_element = axis2_om_node_set_data_element;
node->om_node.ops->set_first_child = axis2_om_node_set_parent;
- node->om_node.ops->set_last_child = axis2_om_node_set_last_child;
node->om_node.ops->set_previous_sibling = axis2_om_node_set_previous_sibling;
node->om_node.ops->set_next_sibling = axis2_om_node_set_next_sibling;
node->om_node.ops->set_first_child = axis2_om_node_set_first_child;
- node->om_node.ops->set_last_child = axis2_om_node_set_last_child;
node->om_node.ops->set_node_type = axis2_om_node_set_node_type;
node->om_node.ops->set_build_status = axis2_om_node_set_build_status;
@@ -686,17 +680,6 @@
return AXIS2_SUCCESS;
}
-axis2_status_t AXIS2_CALL
-axis2_om_node_set_last_child(axis2_om_node_t *om_node,axis2_env_t **env,
- axis2_om_node_t *last_child)
-{
-
- AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- AXIS2_PARAM_CHECK((*env)->error, last_child, AXIS2_FAILURE);
-
- AXIS2_INTF_TO_IMPL(om_node)->last_child = last_child;
- return AXIS2_SUCCESS;
-}
axis2_status_t AXIS2_CALL
axis2_om_node_set_previous_sibling(axis2_om_node_t *om_node,
axis2_env_t **env,
Modified: webservices/axis2/trunk/c/test/xml/soap/test_soap.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/test/xml/soap/test_soap.c?rev=384128&r1=384127&r2=384128&view=diff
==============================================================================
--- webservices/axis2/trunk/c/test/xml/soap/test_soap.c (original)
+++ webservices/axis2/trunk/c/test/xml/soap/test_soap.c Tue Mar 7 22:11:44 2006
@@ -197,11 +197,9 @@
buffer = AXIS2_XML_WRITER_GET_XML(xml_writer, env);
printf("%s \n", buffer);
- free(buffer);
- buffer = NULL;
-
AXIS2_SOAP_ENVELOPE_FREE(soap_envelope, env);
AXIS2_FREE((*env)->allocator, buffer);
+ buffer = NULL;
AXIS2_OM_OUTPUT_FREE(om_output, env);
return AXIS2_SUCCESS;
}
@@ -258,5 +256,6 @@
create_soap_fault(&env);
axis2_env_free(env);
axis2_allocator_free(allocator);
+ getchar();
return 0;
}