axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From din...@apache.org
Subject svn commit: r598873 - in /webservices/axis2/trunk/c: src/core/deployment/dep_engine.c util/include/axutil_utils.h util/src/array_list.c
Date Wed, 28 Nov 2007 05:48:09 GMT
Author: dinesh
Date: Tue Nov 27 21:48:06 2007
New Revision: 598873

URL: http://svn.apache.org/viewvc?rev=598873&view=rev
Log:
Improved param checking in array_list and made the changes suggested by bill in axis2c-783

Modified:
    webservices/axis2/trunk/c/src/core/deployment/dep_engine.c
    webservices/axis2/trunk/c/util/include/axutil_utils.h
    webservices/axis2/trunk/c/util/src/array_list.c

Modified: webservices/axis2/trunk/c/src/core/deployment/dep_engine.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/deployment/dep_engine.c?rev=598873&r1=598872&r2=598873&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/deployment/dep_engine.c (original)
+++ webservices/axis2/trunk/c/src/core/deployment/dep_engine.c Tue Nov 27 21:48:06 2007
@@ -746,6 +746,7 @@
     if (!dep_engine->repos_listener)
     {
         axis2_conf_free(dep_engine->conf, env);
+        dep_engine->conf = NULL;
         return NULL;
     }
     axis2_conf_set_repo(dep_engine->conf, env, dep_engine->axis2_repos);
@@ -760,6 +761,7 @@
     {
         axis2_repos_listener_free(dep_engine->repos_listener, env);
         axis2_conf_free(dep_engine->conf, env);
+        dep_engine->conf = NULL;
         AXIS2_ERROR_SET(env->error, AXIS2_ERROR_MODULE_VALIDATION_FAILED,
                         AXIS2_FAILURE);
         return NULL;
@@ -771,6 +773,7 @@
     {
         axis2_repos_listener_free(dep_engine->repos_listener, env);
         axis2_conf_free(dep_engine->conf, env);
+        dep_engine->conf = NULL;
         return NULL;
     }
 	
@@ -784,6 +787,7 @@
     {
         axis2_repos_listener_free(dep_engine->repos_listener, env);
         axis2_conf_free(dep_engine->conf, env);
+        dep_engine->conf = NULL;
         return NULL;
     }
 	
@@ -794,6 +798,7 @@
             "[axis2] dep engine failed to engaged_modules");
         axis2_repos_listener_free(dep_engine->repos_listener, env);
         axis2_conf_free(dep_engine->conf, env);
+        dep_engine->conf = NULL;
         AXIS2_ERROR_SET(env->error, AXIS2_ERROR_MODULE_VALIDATION_FAILED,
                         AXIS2_FAILURE);
         return NULL;
@@ -928,6 +933,7 @@
     {
         axis2_repos_listener_free(dep_engine->repos_listener, env);
         axis2_conf_free(dep_engine->conf, env);
+        dep_engine->conf = NULL;
         AXIS2_ERROR_SET(env->error, AXIS2_ERROR_MODULE_VALIDATION_FAILED,
                         AXIS2_FAILURE);
         return NULL;
@@ -1427,6 +1433,7 @@
             switch (type)
             {
                 case AXIS2_SVC:
+                {
                     arch_reader = axis2_arch_reader_create(env);
 
                     svc_grp = axis2_svc_grp_create_with_conf(env, dep_engine->conf);
@@ -1438,21 +1445,26 @@
                     if (AXIS2_SUCCESS != status)
                     {
                         axis2_arch_reader_free(arch_reader, env);
+                        arch_reader = NULL;
                         AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_SVC,
                                         AXIS2_FAILURE);
                         return status;
                     }
+
                     status = axis2_dep_engine_add_new_svc(dep_engine, env, svc_grp);
                     if (AXIS2_SUCCESS != status)
                     {
                         axis2_arch_reader_free(arch_reader, env);
+                        arch_reader = NULL;
                         AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_SVC,
                                         AXIS2_FAILURE);
                         return status;
                     }
                     dep_engine->curr_file = NULL;
                     break;
+                }
                 case AXIS2_MODULE:
+                {
                     arch_reader = axis2_arch_reader_create(env);
                     if (dep_engine->arch_reader)
                     {
@@ -1468,6 +1480,7 @@
                     if (AXIS2_SUCCESS != status)
                     {
                         axis2_arch_reader_free(arch_reader, env);
+                        arch_reader = NULL;
                         AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_MODULE,
                                         AXIS2_FAILURE);
                         return AXIS2_FAILURE;
@@ -1477,6 +1490,7 @@
                     if (AXIS2_SUCCESS != status)
                     {
                         axis2_arch_reader_free(arch_reader, env);
+                        arch_reader = NULL;
                         AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_MODULE,
                                         AXIS2_FAILURE);
                         return AXIS2_FAILURE;
@@ -1484,8 +1498,11 @@
 
                     dep_engine->curr_file = NULL;
                     break;
-            }
+                }
+            };
             axis2_arch_reader_free(arch_reader, env);
+            dep_engine->arch_reader = NULL;
+            dep_engine->curr_file = NULL;
         }
     }
     return AXIS2_SUCCESS;

Modified: webservices/axis2/trunk/c/util/include/axutil_utils.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/include/axutil_utils.h?rev=598873&r1=598872&r2=598873&view=diff
==============================================================================
--- webservices/axis2/trunk/c/util/include/axutil_utils.h (original)
+++ webservices/axis2/trunk/c/util/include/axutil_utils.h Tue Nov 27 21:48:06 2007
@@ -54,16 +54,11 @@
      *         function return a type pointer return NULL
      */
 #define AXIS2_FUNC_PARAM_CHECK(object, env, error_return) \
-    AXIS2_ENV_CHECK(env, error_return);\
     if (!object) \
     { \
         AXIS2_ERROR_SET_ERROR_NUMBER(env->error, AXIS2_ERROR_INVALID_NULL_PARAM); \
         AXIS2_ERROR_SET_STATUS_CODE(env->error, AXIS2_FAILURE); \
         return error_return; \
-    } \
-    else \
-    { \
-        AXIS2_ERROR_SET_STATUS_CODE(env->error, AXIS2_SUCCESS); \
     }
 
     /**This macro is called to check whether an object is NULL.
@@ -81,11 +76,17 @@
         AXIS2_ERROR_SET_ERROR_NUMBER(error, AXIS2_ERROR_INVALID_NULL_PARAM); \
         AXIS2_ERROR_SET_STATUS_CODE(error, AXIS2_FAILURE); \
         return error_return; \
-    } \
-    else \
+    }
+
+
+#define AXIS2_PARAM_CHECK_VOID(error, object) \
+    if (!object) \
     { \
-        AXIS2_ERROR_SET_STATUS_CODE(error, AXIS2_SUCCESS); \
+        AXIS2_ERROR_SET_ERROR_NUMBER(error, AXIS2_ERROR_INVALID_NULL_PARAM); \
+        AXIS2_ERROR_SET_STATUS_CODE(error, AXIS2_FAILURE); \
+        return; \
     }
+
 
     /**This macro is used to handle error situation.
      * @param error_number Error number for the error occured

Modified: webservices/axis2/trunk/c/util/src/array_list.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/array_list.c?rev=598873&r1=598872&r2=598873&view=diff
==============================================================================
--- webservices/axis2/trunk/c/util/src/array_list.c (original)
+++ webservices/axis2/trunk/c/util/src/array_list.c Tue Nov 27 21:48:06 2007
@@ -40,8 +40,6 @@
 {
     axutil_array_list_t *array_list = NULL;
 
-    AXIS2_ENV_CHECK(env, NULL);
-
     array_list = AXIS2_MALLOC(env->allocator, sizeof(axutil_array_list_t));
     if (!array_list)
     {
@@ -74,8 +72,7 @@
     const axutil_env_t * env,
     int min_capacity)
 {
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-
+    AXIS2_PARAM_CHECK (env->error, array_list, AXIS2_FAILURE);
     if (min_capacity > array_list->capacity)
     {
         int new_capacity =
@@ -103,7 +100,7 @@
     struct axutil_array_list *array_list,
     const axutil_env_t * env)
 {
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    AXIS2_PARAM_CHECK (env->error, array_list, AXIS2_FAILURE);
     return array_list->size;
 }
 
@@ -112,7 +109,7 @@
     struct axutil_array_list * array_list,
     const axutil_env_t * env)
 {
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    AXIS2_PARAM_CHECK (env->error, array_list, AXIS2_FAILURE);
     return array_list->size == 0;
 }
 
@@ -122,7 +119,7 @@
     const axutil_env_t * env,
     void *e)
 {
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    AXIS2_PARAM_CHECK (env->error, array_list, AXIS2_FAILURE);
     return axutil_array_list_index_of(array_list, env, e) != -1;
 }
 
@@ -134,8 +131,7 @@
 {
     int i = 0;
 
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-
+    AXIS2_PARAM_CHECK (env->error, array_list, AXIS2_FAILURE);
     for (i = 0; i < array_list->size; i++)
         if (e == array_list->data[i])
             return i;
@@ -148,6 +144,7 @@
     const axutil_env_t * env,
     int index)
 {
+    AXIS2_PARAM_CHECK (env->error, array_list, AXIS2_FAILURE);
     if (axutil_array_list_check_bound_exclusive(array_list, env, index))
         return array_list->data[index];
     else
@@ -163,8 +160,7 @@
 {
     void *result = NULL;
 
-    AXIS2_ENV_CHECK(env, NULL);
-
+    AXIS2_PARAM_CHECK (env->error, array_list, AXIS2_FAILURE);
     if (axutil_array_list_check_bound_exclusive(array_list, env, index))
     {
         result = array_list->data[index];
@@ -179,7 +175,7 @@
     const axutil_env_t * env,
     const void *e)
 {
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    AXIS2_PARAM_CHECK (env->error, array_list, AXIS2_FAILURE);
     if (array_list->size == array_list->capacity)
         if (axutil_array_list_ensure_capacity
             (array_list, env, array_list->size + 1) != AXIS2_SUCCESS)
@@ -196,7 +192,8 @@
     const void *e)
 {
     int i = 0;
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    AXIS2_PARAM_CHECK (env->error, array_list, AXIS2_FAILURE);
+
     if (!axutil_array_list_check_bound_inclusive(array_list, env, index))
         return AXIS2_FAILURE;
     if (array_list->size == array_list->capacity)
@@ -223,7 +220,7 @@
 {
     void *result = NULL;
     int i = 0;
-    AXIS2_ENV_CHECK(env, NULL);
+    AXIS2_PARAM_CHECK (env->error, array_list, AXIS2_FAILURE);
 
     if (axutil_array_list_check_bound_exclusive(array_list, env, index))
     {
@@ -242,7 +239,7 @@
     const axutil_env_t * env,
     int index)
 {
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    AXIS2_PARAM_CHECK (env->error, array_list, AXIS2_FAILURE);
 
     if (index < 0 || index > array_list->size)
     {
@@ -259,7 +256,7 @@
     const axutil_env_t * env,
     int index)
 {
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    AXIS2_PARAM_CHECK (env->error, array_list, AXIS2_FAILURE);
 
     if (index < 0 || index >= array_list->size)
     {
@@ -275,7 +272,7 @@
     struct axutil_array_list *array_list,
     const axutil_env_t * env)
 {
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    AXIS2_PARAM_CHECK_VOID (env->error, array_list);
 
     if (array_list->data)
     {
@@ -292,9 +289,16 @@
 {
     axutil_array_list_t *array_list_l = NULL;
 
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    AXIS2_PARAM_CHECK_VOID (env->error, array_list);
 
     array_list_l = (axutil_array_list_t *) array_list;
     axutil_array_list_free(array_list_l, env);
     return;
 }
+
+
+
+
+
+
+



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Mime
View raw message