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 sh...@apache.org on 2009/08/18 12:15:53 UTC

svn commit: r805347 [14/31] - in /webservices/axis2/trunk/c/src: core/addr/ core/clientapi/ core/context/ core/deployment/ core/description/ core/engine/ core/phaseresolver/ core/receivers/ core/transport/amqp/receiver/ core/transport/amqp/receiver/qpi...

Modified: webservices/axis2/trunk/c/src/core/engine/phase.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/engine/phase.c?rev=805347&r1=805346&r2=805347&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/engine/phase.c (original)
+++ webservices/axis2/trunk/c/src/core/engine/phase.c Tue Aug 18 10:15:49 2009
@@ -1,4 +1,3 @@
-
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -22,12 +21,14 @@
 #include <axis2_msg_ctx.h>
 #include <axis2_const.h>
 
-static axis2_status_t axis2_phase_add_unique(
+static axis2_status_t
+axis2_phase_add_unique(
     const axutil_env_t * env,
     axutil_array_list_t * list,
     axis2_handler_t * handler);
 
-static axis2_status_t axis2_phase_remove_unique(
+static axis2_status_t
+axis2_phase_remove_unique(
     const axutil_env_t * env,
     axutil_array_list_t * list,
     axis2_handler_t * handler);
@@ -70,11 +71,10 @@
     axis2_phase_t *phase = NULL;
 
     phase = AXIS2_MALLOC(env->allocator, sizeof(axis2_phase_t));
-    if (!phase)
+    if(!phase)
     {
         AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-            "No memory");
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "No memory");
         return NULL;
     }
 
@@ -88,7 +88,7 @@
     phase->ref = 1;
 
     phase->handlers = axutil_array_list_create(env, 10);
-    if (!(phase->handlers))
+    if(!(phase->handlers))
     {
 
         /** error is already set by last method array list container create */
@@ -96,10 +96,10 @@
         return NULL;
     }
 
-    if (phase_name)
+    if(phase_name)
     {
         phase->name = axutil_strdup(env, phase_name);
-        if (!(phase->name))
+        if(!(phase->name))
         {
             AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
             AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "No memory");
@@ -119,10 +119,8 @@
     axis2_handler_t * handler)
 {
     AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI,
-                    "axis2_handler_t *%s added to the index %d of the phase %s",
-                    axutil_string_get_buffer(axis2_handler_get_name
-                                             (handler, env), env), index,
-                    phase->name);
+        "axis2_handler_t *%s added to the index %d of the phase %s", axutil_string_get_buffer(
+            axis2_handler_get_name(handler, env), env), index, phase->name);
 
     return axutil_array_list_add_at(phase->handlers, env, index, handler);
 }
@@ -133,9 +131,8 @@
     const axutil_env_t * env,
     axis2_handler_t * handler)
 {
-    AXIS2_LOG_INFO(env->log, "Handler %s added to phase %s",
-                   axutil_string_get_buffer(axis2_handler_get_name
-                                            (handler, env), env), phase->name);
+    AXIS2_LOG_INFO(env->log, "Handler %s added to phase %s", axutil_string_get_buffer(
+        axis2_handler_get_name(handler, env), env), phase->name);
 
     return axis2_phase_add_unique(env, phase->handlers, handler);
 }
@@ -146,9 +143,8 @@
     const axutil_env_t * env,
     axis2_handler_t * handler)
 {
-    AXIS2_LOG_INFO(env->log, "Handler %s romoved from phase %s",
-                   axutil_string_get_buffer(axis2_handler_get_name
-                                            (handler, env), env), phase->name);
+    AXIS2_LOG_INFO(env->log, "Handler %s romoved from phase %s", axutil_string_get_buffer(
+        axis2_handler_get_name(handler, env), env), phase->name);
 
     return axis2_phase_remove_unique(env, phase->handlers, handler);
 }
@@ -159,84 +155,78 @@
     const axutil_env_t * env,
     axis2_msg_ctx_t * msg_ctx)
 {
-    int index = 0,
-        size = 0;
+    int index = 0, size = 0;
     axis2_status_t status = AXIS2_SUCCESS;
-    
+
     AXIS2_LOG_TRACE(env->log, AXIS2_LOG_SI, "Entry:axis2_phase_invoke");
     axis2_msg_ctx_set_paused_phase_name(msg_ctx, env, phase->name);
-    if (phase->first_handler)
+    if(phase->first_handler)
     {
-        if (axis2_msg_ctx_is_paused(msg_ctx, env))
+        if(axis2_msg_ctx_is_paused(msg_ctx, env))
         {
-            AXIS2_LOG_INFO(env->log, "Message context is paused in the phase %s", 
-                phase->name);
+            AXIS2_LOG_INFO(env->log, "Message context is paused in the phase %s", phase->name);
             return AXIS2_SUCCESS;
         }
         else
         {
-            const axis2_char_t *handler_name = axutil_string_get_buffer(
-                axis2_handler_get_name(phase->first_handler, env), env);
-            AXIS2_LOG_INFO(env->log,
-                "Invoke the first handler %s within the phase %s", handler_name, 
-                    phase->name);
+            const axis2_char_t *handler_name = axutil_string_get_buffer(axis2_handler_get_name(
+                phase->first_handler, env), env);
+            AXIS2_LOG_INFO(env->log, "Invoke the first handler %s within the phase %s",
+                handler_name, phase->name);
 
             status = axis2_handler_invoke(phase->first_handler, env, msg_ctx);
-            if (!status)
+            if(!status)
             {
-                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
-                    "Handler %s invoke failed within phase %s", handler_name, 
-                        phase->name);
+                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Handler %s invoke failed within phase %s",
+                    handler_name, phase->name);
                 return status;
             }
         }
     }
     /* Invoking the rest of handlers except first_handler and last_handler */
     size = axutil_array_list_size(phase->handlers, env);
-    while (index < size)
+    while(index < size)
     {
-        if (axis2_msg_ctx_is_paused(msg_ctx, env))
+        if(axis2_msg_ctx_is_paused(msg_ctx, env))
         {
             break;
         }
         else
         {
-            axis2_handler_t *handler = (axis2_handler_t *)
-                axutil_array_list_get(phase->handlers, env, index);
-            if (handler)
+            axis2_handler_t *handler = (axis2_handler_t *)axutil_array_list_get(phase->handlers,
+                env, index);
+            if(handler)
             {
-                const axis2_char_t *handler_name = axutil_string_get_buffer(
-                    axis2_handler_get_name(handler, env), env);
+                const axis2_char_t *handler_name = axutil_string_get_buffer(axis2_handler_get_name(
+                    handler, env), env);
                 AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI,
-                    "Invoke the handler %s within the phase %s", handler_name,
-                        phase->name);
+                    "Invoke the handler %s within the phase %s", handler_name, phase->name);
 
                 /* Test code. This is used when valgrind is used to find leaks in Axis2/C modules.*/
                 /*if(!axutil_strcmp(handler_name, "SandeshaGlobalInHandler") || !axutil_strcmp(
-                            handler_name, "SandeshaInHandler"))
+                 handler_name, "SandeshaInHandler"))
+                 {
+                 AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI,
+                 "dam_handler_name %s. dam_phase_name %s", handler_name, phase->name);
+                 if(!axutil_strcmp(handler_name, "SandeshaGlobalInHandler"))
+                 {
+                 status = sandesha2_global_in_handler_invoke(phase->first_handler, env, msg_ctx);
+                 }
+                 if(!axutil_strcmp(handler_name, "SandeshaInHandler"))
+                 {
+                 status = sandesha2_in_handler_invoke(phase->first_handler, env, msg_ctx);
+                 }
+                 }
+                 else*/
+                status = axis2_handler_invoke(handler, env, msg_ctx);
+                if(!status)
                 {
-                    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI,
-                        "dam_handler_name %s. dam_phase_name %s", handler_name, phase->name);
-                    if(!axutil_strcmp(handler_name, "SandeshaGlobalInHandler"))
-                    {
-                        status = sandesha2_global_in_handler_invoke(phase->first_handler, env, msg_ctx);
-                    }
-                    if(!axutil_strcmp(handler_name, "SandeshaInHandler"))
-                    {
-                        status = sandesha2_in_handler_invoke(phase->first_handler, env, msg_ctx);
-                    }
-                }
-                else*/
-                    status = axis2_handler_invoke(handler, env, msg_ctx);
-                if (!status)
-                {
-                    AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
-                        "Handler %s invoke failed within phase %s", 
-                            handler_name, phase->name);
+                    AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+                        "Handler %s invoke failed within phase %s", handler_name, phase->name);
                     return status;
                 }
                 /* index increment should be done after the invoke function. If the invocation
-                   failed this handler is taken care of and no need to revoke again */
+                 failed this handler is taken care of and no need to revoke again */
                 index++;
                 axis2_msg_ctx_set_current_handler_index(msg_ctx, env, index);
             }
@@ -244,28 +234,25 @@
     }
 
     /* If phase last handler is there invoke it here */
-    if (phase->last_handler)
+    if(phase->last_handler)
     {
-        if (axis2_msg_ctx_is_paused(msg_ctx, env))
+        if(axis2_msg_ctx_is_paused(msg_ctx, env))
         {
-            AXIS2_LOG_INFO(env->log, "Message context is paused in the phase %s", 
-                phase->name);
+            AXIS2_LOG_INFO(env->log, "Message context is paused in the phase %s", phase->name);
             return AXIS2_SUCCESS;
         }
         else
         {
-            const axis2_char_t *handler_name = axutil_string_get_buffer(
-                axis2_handler_get_name(phase->last_handler, env), env);
-            AXIS2_LOG_INFO(env->log,
-                "Invoke the last handler %s within the phase %s", handler_name, 
-                phase->name);
-            
+            const axis2_char_t *handler_name = axutil_string_get_buffer(axis2_handler_get_name(
+                phase->last_handler, env), env);
+            AXIS2_LOG_INFO(env->log, "Invoke the last handler %s within the phase %s",
+                handler_name, phase->name);
+
             status = axis2_handler_invoke(phase->last_handler, env, msg_ctx);
-            if (!status)
+            if(!status)
             {
-                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
-                    "Handler %s invoke failed within  phase %s", handler_name, 
-                        phase->name);
+                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+                    "Handler %s invoke failed within  phase %s", handler_name, phase->name);
                 return status;
             }
         }
@@ -295,29 +282,25 @@
     axis2_handler_t * handler,
     const axutil_env_t * env)
 {
-    const axis2_char_t *before = NULL,
-        *after = NULL;
+    const axis2_char_t *before = NULL, *after = NULL;
     axis2_handler_desc_t *handler_desc = NULL;
     axis2_phase_rule_t *rules = NULL;
-    const axis2_char_t *name = 
-        axutil_string_get_buffer(axis2_handler_get_name(handler, env), env);
+    const axis2_char_t *name = axutil_string_get_buffer(axis2_handler_get_name(handler, env), env);
 
     handler_desc = axis2_handler_get_handler_desc(handler, env);
-    if (!handler_desc)
+    if(!handler_desc)
     {
-        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_NULL_PARAM,
-                        AXIS2_FAILURE);
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_NULL_PARAM, AXIS2_FAILURE);
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
             "Handler description is not set for the Handler %s", name);
         return AXIS2_FAILURE;
     }
 
     rules = axis2_handler_desc_get_rules(handler_desc, env);
-    if (!rules)
+    if(!rules)
     {
-        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_NULL_PARAM,
-                        AXIS2_FAILURE);
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_NULL_PARAM, AXIS2_FAILURE);
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
             "Handler rules are not set for the Handler Description %s", name);
         return AXIS2_FAILURE;
     }
@@ -325,23 +308,22 @@
     before = axis2_phase_rule_get_before(rules, env);
     after = axis2_phase_rule_get_after(rules, env);
 
-    if (before && after)
+    if(before && after)
     {
-        if (!axutil_strcmp(before, after))
+        if(!axutil_strcmp(before, after))
         {
-            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_BEFORE_AFTER_HANDLERS_SAME,
-                            AXIS2_FAILURE);
+            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_BEFORE_AFTER_HANDLERS_SAME, AXIS2_FAILURE);
             AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
                 "Both before and after handlers cannot be the same");
             return AXIS2_FAILURE;
         }
         return AXIS2_PHASE_BOTH_BEFORE_AFTER;
     }
-    else if (before)
+    else if(before)
     {
         return AXIS2_PHASE_BEFORE;
     }
-    else if (after)
+    else if(after)
     {
         return AXIS2_PHASE_AFTER;
     }
@@ -357,27 +339,24 @@
     const axutil_env_t * env,
     axis2_handler_t * handler)
 {
-    const axis2_char_t *handler_name = 
-        axutil_string_get_buffer(axis2_handler_get_name(handler, env), env);
+    const axis2_char_t *handler_name = axutil_string_get_buffer(
+        axis2_handler_get_name(handler, env), env);
     const axis2_char_t *phase_name = axis2_phase_get_name(phase, env);
-    if (phase->first_handler_set)
+    if(phase->first_handler_set)
     {
-        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_PHASE_FIRST_HANDLER_ALREADY_SET,
-                        AXIS2_FAILURE);
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_PHASE_FIRST_HANDLER_ALREADY_SET, AXIS2_FAILURE);
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-            "First handler of phase already set, so cannot set handler %s "\
-            "in to the phase %s as first handler", handler_name, phase_name);
+            "First handler of phase already set, so cannot set handler %s "
+                "in to the phase %s as first handler", handler_name, phase_name);
         return AXIS2_FAILURE;
     }
     else
     {
-        if (_axis2_phase_get_before_after(handler, env) != AXIS2_PHASE_ANYWHERE)
+        if(_axis2_phase_get_before_after(handler, env) != AXIS2_PHASE_ANYWHERE)
         {
-            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_PHASE_FIRST_HANDLER,
-                            AXIS2_FAILURE);
-            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
-                "Invalid first handler %s set for the Phase %s", handler_name, 
-                phase_name);
+            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_PHASE_FIRST_HANDLER, AXIS2_FAILURE);
+            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+                "Invalid first handler %s set for the Phase %s", handler_name, phase_name);
             return AXIS2_FAILURE;
         }
         phase->first_handler = handler;
@@ -393,27 +372,24 @@
     const axutil_env_t * env,
     axis2_handler_t * handler)
 {
-    const axis2_char_t *handler_name = 
-        axutil_string_get_buffer(axis2_handler_get_name(handler, env), env);
+    const axis2_char_t *handler_name = axutil_string_get_buffer(
+        axis2_handler_get_name(handler, env), env);
     const axis2_char_t *phase_name = axis2_phase_get_name(phase, env);
-    if (phase->last_handler_set)
+    if(phase->last_handler_set)
     {
-        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_PHASE_LAST_HANDLER_ALREADY_SET,
-                        AXIS2_FAILURE);
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_PHASE_LAST_HANDLER_ALREADY_SET, AXIS2_FAILURE);
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-            "Last handler of phase already set, so cannot set handler %s "\
-            "in to the phase %s as last handler", handler_name, phase_name);
+            "Last handler of phase already set, so cannot set handler %s "
+                "in to the phase %s as last handler", handler_name, phase_name);
         return AXIS2_FAILURE;
     }
     else
     {
-        if (_axis2_phase_get_before_after(handler, env) != AXIS2_PHASE_ANYWHERE)
+        if(_axis2_phase_get_before_after(handler, env) != AXIS2_PHASE_ANYWHERE)
         {
-            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_PHASE_LAST_HANDLER,
-                            AXIS2_FAILURE);
-            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
-                "Invalid last handler %s set for the Phase %s", handler_name, 
-                phase_name);
+            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_PHASE_LAST_HANDLER, AXIS2_FAILURE);
+            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Invalid last handler %s set for the Phase %s",
+                handler_name, phase_name);
             return AXIS2_FAILURE;
         }
         phase->last_handler = handler;
@@ -432,29 +408,25 @@
     axis2_phase_rule_t *rules = NULL;
     axis2_handler_t *handler = NULL;
     axis2_status_t status = AXIS2_SUCCESS;
-    axis2_bool_t first = AXIS2_FALSE,
-        last = AXIS2_FALSE;
-    const axis2_char_t *handler_desc_name = 
-        axutil_string_get_buffer(axis2_handler_desc_get_name(handler_desc, env), 
-            env);
-    if (phase->is_one_handler)
-    {
-        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_PHASE_ADD_HANDLER_INVALID,
-                        AXIS2_FAILURE);
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
-            "Only one handler allowed for phase %s, adding handler %s is not "\
-            "allowed", phase->name, handler_desc_name);
+    axis2_bool_t first = AXIS2_FALSE, last = AXIS2_FALSE;
+    const axis2_char_t *handler_desc_name = axutil_string_get_buffer(axis2_handler_desc_get_name(
+        handler_desc, env), env);
+    if(phase->is_one_handler)
+    {
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_PHASE_ADD_HANDLER_INVALID, AXIS2_FAILURE);
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+            "Only one handler allowed for phase %s, adding handler %s is not "
+                "allowed", phase->name, handler_desc_name);
         return AXIS2_FAILURE;
     }
     else
     {
         rules = axis2_handler_desc_get_rules(handler_desc, env);
-        if (!rules)
+        if(!rules)
         {
-            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_NULL_PARAM,
-                            AXIS2_FAILURE);
+            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_NULL_PARAM, AXIS2_FAILURE);
             AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-                "Handler rules are not set for the Hanlder Description %s "\
+                "Handler rules are not set for the Hanlder Description %s "
                     "within phase %s", handler_desc_name, phase->name);
             return AXIS2_FAILURE;
         }
@@ -462,58 +434,54 @@
         first = axis2_phase_rule_is_first(rules, env);
         last = axis2_phase_rule_is_last(rules, env);
 
-        if (first && last)
+        if(first && last)
         {
-            if (axutil_array_list_size(phase->handlers, env) > 0)
+            if(axutil_array_list_size(phase->handlers, env) > 0)
             {
-                AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_HANDLER_RULES,
-                                AXIS2_FAILURE);
+                AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_HANDLER_RULES, AXIS2_FAILURE);
                 AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-                    "Invalid handler rules, so unable to add handler %s to "\
+                    "Invalid handler rules, so unable to add handler %s to "
                         "phase %s", handler_desc_name, phase->name);
                 return AXIS2_FAILURE;
             }
 
             handler = axis2_handler_desc_get_handler(handler_desc, env);
-            if (!handler)
+            if(!handler)
             {
-                AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_NULL_PARAM,
-                                AXIS2_FAILURE);
+                AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_NULL_PARAM, AXIS2_FAILURE);
                 AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-                    "Handler is not set for the Handler Description %s "\
+                    "Handler is not set for the Handler Description %s "
                         "within phase %s", handler_desc_name, phase->name);
                 return AXIS2_FAILURE;
             }
 
             /*status = axutil_array_list_add(phase->handlers, env, handler); */
             status = axis2_phase_add_unique(env, phase->handlers, handler);
-            if (status)
+            if(status)
                 phase->is_one_handler = AXIS2_TRUE;
             return status;
         }
-        else if (first)
+        else if(first)
         {
             handler = axis2_handler_desc_get_handler(handler_desc, env);
-            if (!handler)
+            if(!handler)
             {
-                AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_NULL_PARAM,
-                                AXIS2_FAILURE);
+                AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_NULL_PARAM, AXIS2_FAILURE);
                 AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-                    "Handler is not set for the Handler Description %s "\
+                    "Handler is not set for the Handler Description %s "
                         "within phase %s", handler_desc_name, phase->name);
                 return AXIS2_FAILURE;
             }
             return axis2_phase_set_first_handler(phase, env, handler);
         }
-        else if (last)
+        else if(last)
         {
             handler = axis2_handler_desc_get_handler(handler_desc, env);
-            if (!handler)
+            if(!handler)
             {
-                AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_NULL_PARAM,
-                                AXIS2_FAILURE);
+                AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_NULL_PARAM, AXIS2_FAILURE);
                 AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-                    "Handler is not set for the Handler Description %s "\
+                    "Handler is not set for the Handler Description %s "
                         "within phase %s", handler_desc_name, phase->name);
                 return AXIS2_FAILURE;
             }
@@ -522,12 +490,11 @@
         else
         {
             handler = axis2_handler_desc_get_handler(handler_desc, env);
-            if (!handler)
+            if(!handler)
             {
-                AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_NULL_PARAM,
-                                AXIS2_FAILURE);
+                AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_NULL_PARAM, AXIS2_FAILURE);
                 AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-                    "Handler is not set for the Handler Description %s "\
+                    "Handler is not set for the Handler Description %s "
                         "within phase %s", handler_desc_name, phase->name);
                 return AXIS2_FAILURE;
             }
@@ -545,36 +512,33 @@
 {
     axis2_phase_rule_t *rules = NULL;
     axis2_handler_desc_t *handler_desc = NULL;
-    const axis2_char_t *first_handler_name = NULL,
-        *before = NULL;
+    const axis2_char_t *first_handler_name = NULL, *before = NULL;
 
-    if (phase->first_handler)
+    if(phase->first_handler)
     {
-        handler_desc =
-            axis2_handler_get_handler_desc(phase->first_handler, env);
-        if (!handler_desc)
+        handler_desc = axis2_handler_get_handler_desc(phase->first_handler, env);
+        if(!handler_desc)
             return AXIS2_TRUE;
 
-        first_handler_name =
-            axutil_string_get_buffer(axis2_handler_desc_get_name
-                                     (handler_desc, env), env);
+        first_handler_name = axutil_string_get_buffer(
+            axis2_handler_desc_get_name(handler_desc, env), env);
 
-        if (!first_handler_name)
+        if(!first_handler_name)
             return AXIS2_TRUE;
 
         handler_desc = axis2_handler_get_handler_desc(handler, env);
-        if (!handler_desc)
+        if(!handler_desc)
             return AXIS2_TRUE;
 
         rules = axis2_handler_desc_get_rules(handler_desc, env);
-        if (!rules)
+        if(!rules)
             return AXIS2_TRUE;
 
         before = axis2_phase_rule_get_before(rules, env);
-        if (!before)
+        if(!before)
             return AXIS2_TRUE;
 
-        if (!axutil_strcmp(first_handler_name, before))
+        if(!axutil_strcmp(first_handler_name, before))
             return AXIS2_FALSE;
         else
             return AXIS2_TRUE;
@@ -591,35 +555,33 @@
 {
     axis2_phase_rule_t *rules = NULL;
     axis2_handler_desc_t *handler_desc = NULL;
-    const axis2_char_t *last_handler_name = NULL,
-        *after = NULL;
+    const axis2_char_t *last_handler_name = NULL, *after = NULL;
 
-    if (phase->last_handler)
+    if(phase->last_handler)
     {
         handler_desc = axis2_handler_get_handler_desc(phase->last_handler, env);
-        if (!handler_desc)
+        if(!handler_desc)
             return AXIS2_TRUE;
 
-        last_handler_name =
-            axutil_string_get_buffer(axis2_handler_desc_get_name
-                                     (handler_desc, env), env);
+        last_handler_name = axutil_string_get_buffer(
+            axis2_handler_desc_get_name(handler_desc, env), env);
 
-        if (!last_handler_name)
+        if(!last_handler_name)
             return AXIS2_TRUE;
 
         handler_desc = axis2_handler_get_handler_desc(handler, env);
-        if (!handler_desc)
+        if(!handler_desc)
             return AXIS2_TRUE;
 
         rules = axis2_handler_desc_get_rules(handler_desc, env);
-        if (!rules)
+        if(!rules)
             return AXIS2_TRUE;
 
         after = axis2_phase_rule_get_after(rules, env);
-        if (!after)
+        if(!after)
             return AXIS2_TRUE;
 
-        if (!axutil_strcmp(last_handler_name, after))
+        if(!axutil_strcmp(last_handler_name, after))
             return AXIS2_FALSE;
         else
             return AXIS2_TRUE;
@@ -636,80 +598,69 @@
 {
     axis2_phase_rule_t *rules = NULL;
     axis2_handler_desc_t *handler_desc = NULL;
-    const axis2_char_t *handler_name = NULL,
-        *before = NULL;
+    const axis2_char_t *handler_name = NULL, *before = NULL;
     int i = 0;
     int size = 0;
-    const axis2_char_t *name = 
-        axutil_string_get_buffer(axis2_handler_get_name(handler, env), env);
+    const axis2_char_t *name = axutil_string_get_buffer(axis2_handler_get_name(handler, env), env);
     const axis2_char_t *handler_desc_name = NULL;
 
     handler_desc = axis2_handler_get_handler_desc(handler, env);
-    if (!handler_desc)
+    if(!handler_desc)
     {
-        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_NULL_PARAM,
-                        AXIS2_FAILURE);
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
-            "Handler description is not set in the handler %s within phase %s", 
-                name, phase->name);
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_NULL_PARAM, AXIS2_FAILURE);
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+            "Handler description is not set in the handler %s within phase %s", name, phase->name);
         return AXIS2_FAILURE;
     }
-    handler_desc_name = axutil_string_get_buffer(axis2_handler_desc_get_name(
-        handler_desc, env), env);
+    handler_desc_name = axutil_string_get_buffer(axis2_handler_desc_get_name(handler_desc, env),
+        env);
 
     rules = axis2_handler_desc_get_rules(handler_desc, env);
-    if (!rules)
+    if(!rules)
     {
-        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_NULL_PARAM,
-                        AXIS2_FAILURE);
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_NULL_PARAM, AXIS2_FAILURE);
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-            "Handler rules are not set in the handler description %s within "\
+            "Handler rules are not set in the handler description %s within "
                 "phase %s", handler_desc_name, phase->name);
         return AXIS2_FAILURE;
     }
 
     before = axis2_phase_rule_get_before(rules, env);
-    if (!before)
+    if(!before)
     {
-        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_NULL_PARAM,
-                        AXIS2_FAILURE);
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_NULL_PARAM, AXIS2_FAILURE);
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-            "Rule `before` is not set in the handler rules for handler %s "\
+            "Rule `before` is not set in the handler rules for handler %s "
                 "within phase %s", name, phase->name);
         return AXIS2_FAILURE;
     }
 
-    if (phase->last_handler)
+    if(phase->last_handler)
     {
-        const axis2_char_t *last_handler_name = 
-            axutil_string_get_buffer(axis2_handler_get_name(phase->last_handler, 
-                env), env);
+        const axis2_char_t *last_handler_name = axutil_string_get_buffer(axis2_handler_get_name(
+            phase->last_handler, env), env);
         handler_desc = axis2_handler_get_handler_desc(phase->last_handler, env);
-        if (!handler_desc)
+        if(!handler_desc)
         {
-            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_HANDLER_STATE,
-                            AXIS2_FAILURE);
+            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_HANDLER_STATE, AXIS2_FAILURE);
             AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-                "Handler description is not set in the last handler %s of "\
+                "Handler description is not set in the last handler %s of "
                     "phase %s", last_handler_name, phase->name);
             return AXIS2_FAILURE;
         }
 
-        handler_name =
-            axutil_string_get_buffer(axis2_handler_desc_get_name
-                                     (handler_desc, env), env);
-        if (!handler_name)
+        handler_name
+            = axutil_string_get_buffer(axis2_handler_desc_get_name(handler_desc, env), env);
+        if(!handler_name)
         {
-            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_HANDLER_STATE,
-                            AXIS2_FAILURE);
+            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_HANDLER_STATE, AXIS2_FAILURE);
             AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-                "Handler name is not set in the handler description for "\
-                    "last handler %s within phase %s", last_handler_name, 
-                        phase->name);
+                "Handler name is not set in the handler description for "
+                    "last handler %s within phase %s", last_handler_name, phase->name);
             return AXIS2_FAILURE;
         }
 
-        if (!axutil_strcmp(before, handler_name))
+        if(!axutil_strcmp(before, handler_name))
         {
             /*return axutil_array_list_add(phase->handlers, env, handler); */
             return axis2_phase_add_unique(env, phase->handlers, handler);
@@ -718,44 +669,38 @@
 
     size = axutil_array_list_size(phase->handlers, env);
 
-    for (i = 0; i < size; i++)
+    for(i = 0; i < size; i++)
     {
-        axis2_handler_t *temp_handler =
-            (axis2_handler_t *) axutil_array_list_get(phase->handlers, env, i);
-        if (temp_handler)
-        {
-            const axis2_char_t *temp_handler_name = 
-                axutil_string_get_buffer(axis2_handler_get_name(temp_handler, 
-                    env), env);
+        axis2_handler_t *temp_handler = (axis2_handler_t *)axutil_array_list_get(phase->handlers,
+            env, i);
+        if(temp_handler)
+        {
+            const axis2_char_t *temp_handler_name = axutil_string_get_buffer(
+                axis2_handler_get_name(temp_handler, env), env);
             handler_desc = axis2_handler_get_handler_desc(temp_handler, env);
-            if (!handler_desc)
+            if(!handler_desc)
             {
-                AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_HANDLER_STATE,
-                                AXIS2_FAILURE);
+                AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_HANDLER_STATE, AXIS2_FAILURE);
                 AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-                    "Handler Description is not set for the Handler %s "\
+                    "Handler Description is not set for the Handler %s "
                         "within phase %s", temp_handler_name, phase->name);
                 return AXIS2_FAILURE;
             }
 
-            handler_name =
-                axutil_string_get_buffer(axis2_handler_desc_get_name
-                                         (handler_desc, env), env);
-            if (!handler_name)
+            handler_name = axutil_string_get_buffer(axis2_handler_desc_get_name(handler_desc, env),
+                env);
+            if(!handler_name)
             {
-                AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_HANDLER_STATE,
-                                AXIS2_FAILURE);
+                AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_HANDLER_STATE, AXIS2_FAILURE);
                 AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-                    "Handler name is not set in the handler description for "\
-                        "handler %s within phase %s", temp_handler_name, 
-                            phase->name);
+                    "Handler name is not set in the handler description for "
+                        "handler %s within phase %s", temp_handler_name, phase->name);
                 return AXIS2_FAILURE;
             }
 
-            if (!axutil_strcmp(before, handler_name))
+            if(!axutil_strcmp(before, handler_name))
             {
-                return axutil_array_list_add_at(phase->handlers, env, i,
-                                                handler);
+                return axutil_array_list_add_at(phase->handlers, env, i, handler);
             }
         }
     }
@@ -776,74 +721,65 @@
     const axis2_char_t *after = NULL;
     int i = 0;
     int size = 0;
-    const axis2_char_t *name = axutil_string_get_buffer(
-        axis2_handler_get_name(handler, env), env);
+    const axis2_char_t *name = axutil_string_get_buffer(axis2_handler_get_name(handler, env), env);
     const axis2_char_t *handler_desc_name = NULL;
 
     handler_desc = axis2_handler_get_handler_desc(handler, env);
-    if (!handler_desc)
+    if(!handler_desc)
     {
-        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_NULL_PARAM,
-                        AXIS2_FAILURE);
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
-            "Handler description is not set in the handler %s within phase %s",
-                name, phase->name);
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_NULL_PARAM, AXIS2_FAILURE);
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+            "Handler description is not set in the handler %s within phase %s", name, phase->name);
         return AXIS2_FAILURE;
     }
-    handler_desc_name = axutil_string_get_buffer(
-        axis2_handler_desc_get_name(handler_desc, env), env);
+    handler_desc_name = axutil_string_get_buffer(axis2_handler_desc_get_name(handler_desc, env),
+        env);
     rules = axis2_handler_desc_get_rules(handler_desc, env);
-    if (!rules)
+    if(!rules)
     {
-        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_NULL_PARAM,
-                        AXIS2_FAILURE);
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_NULL_PARAM, AXIS2_FAILURE);
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-            "Handler rules are not set in the handler description %s within "\
+            "Handler rules are not set in the handler description %s within "
                 "phase %s", handler_desc_name, phase->name);
         return AXIS2_FAILURE;
     }
 
     after = axis2_phase_rule_get_after(rules, env);
-    if (!after)
+    if(!after)
     {
-        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_NULL_PARAM,
-                        AXIS2_FAILURE);
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_NULL_PARAM, AXIS2_FAILURE);
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-            "Rule `after` is not set in the handler rules for handler desc "\
+            "Rule `after` is not set in the handler rules for handler desc "
                 "%s within phase %s", handler_desc_name, phase->name);
         return AXIS2_FAILURE;
     }
 
-    if (phase->first_handler)
+    if(phase->first_handler)
     {
-        const axis2_char_t *first_handler_name = axutil_string_get_buffer(
-            axis2_handler_get_name(phase->first_handler, env), env);
-        handler_desc =
-            axis2_handler_get_handler_desc(phase->first_handler, env);
-        if (!handler_desc)
+        const axis2_char_t *first_handler_name = axutil_string_get_buffer(axis2_handler_get_name(
+            phase->first_handler, env), env);
+        handler_desc = axis2_handler_get_handler_desc(phase->first_handler, env);
+        if(!handler_desc)
         {
-            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_HANDLER_STATE,
-                            AXIS2_FAILURE);
+            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_HANDLER_STATE, AXIS2_FAILURE);
             AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-                "Handler description is not set in the first handler %s "\
+                "Handler description is not set in the first handler %s "
                     "within phase %s", first_handler_name, phase->name);
             return AXIS2_FAILURE;
         }
 
-        handler_name =
-            axutil_string_get_buffer(axis2_handler_desc_get_name
-                                     (handler_desc, env), env);
-        if (!handler_name)
+        handler_name
+            = axutil_string_get_buffer(axis2_handler_desc_get_name(handler_desc, env), env);
+        if(!handler_name)
         {
-            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_HANDLER_STATE,
-                            AXIS2_FAILURE);
+            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_HANDLER_STATE, AXIS2_FAILURE);
             AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-                "Handler name is not set in the handler description for "\
+                "Handler name is not set in the handler description for "
                     "handler %s within phase %s", name, phase->name);
             return AXIS2_FAILURE;
         }
 
-        if (!axutil_strcmp(after, handler_name))
+        if(!axutil_strcmp(after, handler_name))
         {
             return axutil_array_list_add_at(phase->handlers, env, 0, handler);
         }
@@ -851,53 +787,48 @@
 
     size = axutil_array_list_size(phase->handlers, env);
 
-    for (i = 0; i < size; i++)
+    for(i = 0; i < size; i++)
     {
-        axis2_handler_t *temp_handler =
-            (axis2_handler_t *) axutil_array_list_get(phase->handlers, env, i);
-        if (temp_handler)
+        axis2_handler_t *temp_handler = (axis2_handler_t *)axutil_array_list_get(phase->handlers,
+            env, i);
+        if(temp_handler)
         {
             const axis2_char_t *temp_handler_name = axutil_string_get_buffer(
                 axis2_handler_get_name(temp_handler, env), env);
             handler_desc = axis2_handler_get_handler_desc(temp_handler, env);
-            if (!handler_desc)
+            if(!handler_desc)
             {
-                AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_HANDLER_STATE,
-                                AXIS2_FAILURE);
+                AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_HANDLER_STATE, AXIS2_FAILURE);
                 AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-                    "Handler description is not set in the handler %s within"\
+                    "Handler description is not set in the handler %s within"
                         " phase %s", temp_handler_name, phase->name);
                 return AXIS2_FAILURE;
             }
 
-            handler_name =
-                axutil_string_get_buffer(axis2_handler_desc_get_name
-                                         (handler_desc, env), env);
-            if (!handler_name)
+            handler_name = axutil_string_get_buffer(axis2_handler_desc_get_name(handler_desc, env),
+                env);
+            if(!handler_name)
             {
-                AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_HANDLER_STATE,
-                                AXIS2_FAILURE);
+                AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_HANDLER_STATE, AXIS2_FAILURE);
                 AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-                    "Handler name is not set in the handler description %s "\
+                    "Handler name is not set in the handler description %s "
                         "within phase %s", temp_handler_name, phase->name);
                 return AXIS2_FAILURE;
             }
 
-            if (!axutil_strcmp(after, handler_name))
+            if(!axutil_strcmp(after, handler_name))
             {
-                if (i == (size - 1))
+                if(i == (size - 1))
                 {
-                    return axis2_phase_add_unique(env, phase->handlers,
-                                                  handler);
+                    return axis2_phase_add_unique(env, phase->handlers, handler);
                 }
                 else
-                    return axutil_array_list_add_at(phase->handlers, env, i + 1,
-                                                    handler);
+                    return axutil_array_list_add_at(phase->handlers, env, i + 1, handler);
             }
         }
     }
 
-    if (size > 0)
+    if(size > 0)
         return axutil_array_list_add_at(phase->handlers, env, 0, handler);
     else
     {
@@ -915,210 +846,185 @@
     int after = -1;
     axis2_phase_rule_t *rules = NULL;
     axis2_handler_desc_t *handler_desc = NULL;
-    const axis2_char_t *before_handler_name = NULL,
-        *after_handler_name = NULL,
-        *after_name = NULL,
-        *before_name = NULL,
-        *handler_name = NULL;
+    const axis2_char_t *before_handler_name = NULL, *after_handler_name = NULL, *after_name = NULL,
+        *before_name = NULL, *handler_name = NULL;
     int i = 0;
     int size = 0;
-    const axis2_char_t *name = axutil_string_get_buffer(
-        axis2_handler_get_name(handler, env), env);
+    const axis2_char_t *name = axutil_string_get_buffer(axis2_handler_get_name(handler, env), env);
     const axis2_char_t *handler_desc_name = NULL;
 
     handler_desc = axis2_handler_get_handler_desc(handler, env);
-    if (!handler_desc)
+    if(!handler_desc)
     {
-        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_NULL_PARAM,
-                        AXIS2_FAILURE);
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
-            "Handler description is not set in the handler %s within phase %s", 
-                name, phase->name);
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_NULL_PARAM, AXIS2_FAILURE);
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+            "Handler description is not set in the handler %s within phase %s", name, phase->name);
         return AXIS2_FAILURE;
     }
-    handler_desc_name = axutil_string_get_buffer(
-        axis2_handler_desc_get_name(handler_desc, env), env);
+    handler_desc_name = axutil_string_get_buffer(axis2_handler_desc_get_name(handler_desc, env),
+        env);
 
     rules = axis2_handler_desc_get_rules(handler_desc, env);
-    if (!rules)
+    if(!rules)
     {
-        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_NULL_PARAM,
-                        AXIS2_FAILURE);
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_NULL_PARAM, AXIS2_FAILURE);
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-            "Handler rules are not set in the handler description %s within "\
+            "Handler rules are not set in the handler description %s within "
                 "phase %s", handler_desc_name, phase->name);
         return AXIS2_FAILURE;
     }
 
     before_name = axis2_phase_rule_get_before(rules, env);
-    if (!before_name)
+    if(!before_name)
     {
-        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_NULL_PARAM,
-                        AXIS2_FAILURE);
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_NULL_PARAM, AXIS2_FAILURE);
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-            "Rule `before` is not set in the handler rules for handler desc "\
-            "   %s within phase %s", handler_desc_name, phase->name);
+            "Rule `before` is not set in the handler rules for handler desc "
+                "   %s within phase %s", handler_desc_name, phase->name);
         return AXIS2_FAILURE;
     }
 
     after_name = axis2_phase_rule_get_after(rules, env);
-    if (!after_name)
+    if(!after_name)
     {
-        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_NULL_PARAM,
-                        AXIS2_FAILURE);
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_NULL_PARAM, AXIS2_FAILURE);
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-            "Rule `after` is not set in the handler rules for handler desc "\
+            "Rule `after` is not set in the handler rules for handler desc "
                 "%s within phase %s", handler_desc_name, phase->name);
         return AXIS2_FAILURE;
     }
 
-    if (phase->first_handler)
+    if(phase->first_handler)
     {
-        const axis2_char_t *first_handler_name = axutil_string_get_buffer(
-            axis2_handler_get_name(phase->first_handler, env), env);
-        handler_desc =
-            axis2_handler_get_handler_desc(phase->first_handler, env);
-        if (!handler_desc)
+        const axis2_char_t *first_handler_name = axutil_string_get_buffer(axis2_handler_get_name(
+            phase->first_handler, env), env);
+        handler_desc = axis2_handler_get_handler_desc(phase->first_handler, env);
+        if(!handler_desc)
         {
-            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_HANDLER_STATE,
-                            AXIS2_FAILURE);
+            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_HANDLER_STATE, AXIS2_FAILURE);
             AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-                "Handler description is not set in the first handler %s "\
+                "Handler description is not set in the first handler %s "
                     "within phase %s", first_handler_name, phase->name);
             return AXIS2_FAILURE;
         }
 
-        before_handler_name =
-            axutil_string_get_buffer(axis2_handler_desc_get_name
-                                     (handler_desc, env), env);
-        if (!before_handler_name)
+        before_handler_name = axutil_string_get_buffer(axis2_handler_desc_get_name(handler_desc,
+            env), env);
+        if(!before_handler_name)
         {
-            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_HANDLER_STATE,
-                            AXIS2_FAILURE);
+            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_HANDLER_STATE, AXIS2_FAILURE);
             AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-                "Handler name is not set in the handler description for the "\
-                    "first handler %s within phase %s", first_handler_name, 
-                        phase->name);
+                "Handler name is not set in the handler description for the "
+                    "first handler %s within phase %s", first_handler_name, phase->name);
             return AXIS2_FAILURE;
         }
     }
 
-    if (phase->last_handler)
+    if(phase->last_handler)
     {
-        const axis2_char_t *last_handler_name = axutil_string_get_buffer(
-            axis2_handler_get_name(phase->last_handler, env), env);
+        const axis2_char_t *last_handler_name = axutil_string_get_buffer(axis2_handler_get_name(
+            phase->last_handler, env), env);
         handler_desc = axis2_handler_get_handler_desc(phase->last_handler, env);
-        if (!handler_desc)
+        if(!handler_desc)
         {
-            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_HANDLER_STATE,
-                            AXIS2_FAILURE);
+            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_HANDLER_STATE, AXIS2_FAILURE);
             AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-                "Handler description is not set in the last handler %s "\
+                "Handler description is not set in the last handler %s "
                     "within phase %s", last_handler_name, phase->name);
             return AXIS2_FAILURE;
         }
 
-        after_handler_name =
-            axutil_string_get_buffer(axis2_handler_desc_get_name
-                                     (handler_desc, env), env);
-        if (!after_handler_name)
+        after_handler_name = axutil_string_get_buffer(
+            axis2_handler_desc_get_name(handler_desc, env), env);
+        if(!after_handler_name)
         {
-            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_HANDLER_STATE,
-                            AXIS2_FAILURE);
+            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_HANDLER_STATE, AXIS2_FAILURE);
             AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-                "Handler name is not set in the handler description for the "\
-                    "last handler %s within phase %s", last_handler_name, 
-                        phase->name);
+                "Handler name is not set in the handler description for the "
+                    "last handler %s within phase %s", last_handler_name, phase->name);
             return AXIS2_FAILURE;
         }
     }
 
-    if (before_handler_name && after_handler_name)
+    if(before_handler_name && after_handler_name)
     {
-        if (!axutil_strcmp(before_handler_name, before_name) &&
-            !axutil_strcmp(after_handler_name, after_name))
+        if(!axutil_strcmp(before_handler_name, before_name) && !axutil_strcmp(after_handler_name,
+            after_name))
         {
             return axis2_phase_add_unique(env, phase->handlers, handler);
         }
     }
 
-    if (after_handler_name)
+    if(after_handler_name)
     {
-        if (!axutil_strcmp(after_handler_name, after_name))
+        if(!axutil_strcmp(after_handler_name, after_name))
             after = 0;
     }
 
     size = axutil_array_list_size(phase->handlers, env);
 
-    if (after_handler_name)
+    if(after_handler_name)
     {
-        if (!axutil_strcmp(before_handler_name, before_name))
+        if(!axutil_strcmp(before_handler_name, before_name))
             before = size;
     }
 
-    for (i = 0; i < size; i++)
+    for(i = 0; i < size; i++)
     {
-        axis2_handler_t *temp_handler =
-            (axis2_handler_t *) axutil_array_list_get(phase->handlers, env, i);
-        if (temp_handler)
+        axis2_handler_t *temp_handler = (axis2_handler_t *)axutil_array_list_get(phase->handlers,
+            env, i);
+        if(temp_handler)
         {
             const axis2_char_t *temp_handler_name = axutil_string_get_buffer(
                 axis2_handler_get_name(temp_handler, env), env);
             handler_desc = axis2_handler_get_handler_desc(temp_handler, env);
-            if (!handler_desc)
+            if(!handler_desc)
             {
-                AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_HANDLER_STATE,
-                                AXIS2_FAILURE);
+                AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_HANDLER_STATE, AXIS2_FAILURE);
                 AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-                    "Handler Description is not set for the Handler %s "\
+                    "Handler Description is not set for the Handler %s "
                         "within phase %s", temp_handler_name, phase->name);
                 return AXIS2_FAILURE;
             }
 
-            handler_name =
-                axutil_string_get_buffer(axis2_handler_desc_get_name
-                                         (handler_desc, env), env);
-            if (!handler_name)
+            handler_name = axutil_string_get_buffer(axis2_handler_desc_get_name(handler_desc, env),
+                env);
+            if(!handler_name)
             {
-                AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_HANDLER_STATE,
-                                AXIS2_FAILURE);
+                AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_HANDLER_STATE, AXIS2_FAILURE);
                 AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-                    "Handler name is not set in the handler Description for "\
-                        "handler %s within phase %s", temp_handler_name, 
-                            phase->name);
+                    "Handler name is not set in the handler Description for "
+                        "handler %s within phase %s", temp_handler_name, phase->name);
                 return AXIS2_FAILURE;
             }
 
-            if (!axutil_strcmp(handler_name, after_name))
+            if(!axutil_strcmp(handler_name, after_name))
                 after = i;
-            if (!axutil_strcmp(handler_name, before_name))
+            if(!axutil_strcmp(handler_name, before_name))
                 before = i;
         }
 
-        if ((after >= 0) && (before >= 0))
+        if((after >= 0) && (before >= 0))
         {
             /*both the before and after indexes have been found */
-            if (after > before)
+            if(after > before)
             {
-                AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_HANDLER_STATE,
-                                AXIS2_FAILURE);
+                AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_HANDLER_STATE, AXIS2_FAILURE);
                 AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-                    "Both the before and after indexes have been found and "\
-                    "`after` comes before `before` which is wrong within "\
-                    "phase %s", phase->name);
+                    "Both the before and after indexes have been found and "
+                        "`after` comes before `before` which is wrong within "
+                        "phase %s", phase->name);
                 return AXIS2_FAILURE;
             }
             else
             {
-                if (after + 1 < size)
+                if(after + 1 < size)
                 {
-                    return axutil_array_list_add_at(phase->handlers, env,
-                                                    after + 1, handler);
+                    return axutil_array_list_add_at(phase->handlers, env, after + 1, handler);
                 }
                 else
                 {
-                    return axis2_phase_add_unique(env, phase->handlers,
-                                                  handler);
+                    return axis2_phase_add_unique(env, phase->handlers, handler);
                 }
             }
         }
@@ -1135,65 +1041,60 @@
     int type = 0;
     axis2_handler_t *handler = NULL;
     axis2_status_t status = AXIS2_FAILURE;
-    const axis2_char_t *handler_desc_name = axutil_string_get_buffer(
-        axis2_handler_desc_get_name(handler_desc, env), env);
+    const axis2_char_t *handler_desc_name = axutil_string_get_buffer(axis2_handler_desc_get_name(
+        handler_desc, env), env);
     const axis2_char_t *handler_name = NULL;
     handler = axis2_handler_desc_get_handler(handler_desc, env);
 
-    if (!handler)
+    if(!handler)
     {
-        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_NULL_PARAM,
-                        AXIS2_FAILURE);
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
-            "Handler is not set in the handler description %s", 
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_NULL_PARAM, AXIS2_FAILURE);
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Handler is not set in the handler description %s",
             handler_desc_name);
         return AXIS2_FAILURE;
     }
-    handler_name = axutil_string_get_buffer(
-        axis2_handler_get_name(handler, env), env);
+    handler_name = axutil_string_get_buffer(axis2_handler_get_name(handler, env), env);
 
-    if (!_axis2_phase_is_valid_after(phase, env, handler))
+    if(!_axis2_phase_is_valid_after(phase, env, handler))
     {
-        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_HANDLER_STATE,
-                        AXIS2_FAILURE);
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
-            "Invalid Handler State for the handler %s within the phase %s", 
-                handler_name, phase->name);
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_HANDLER_STATE, AXIS2_FAILURE);
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+            "Invalid Handler State for the handler %s within the phase %s", handler_name,
+            phase->name);
         return AXIS2_FAILURE;
     }
 
-    if (!_axis2_phase_is_valid_before(phase, env, handler))
+    if(!_axis2_phase_is_valid_before(phase, env, handler))
     {
-        AXIS2_ERROR_SET(env->error,
-                        AXIS2_ERROR_INVALID_HANDLER_STATE, AXIS2_FAILURE);
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
-            "Invalid Handler State for the handler %s within the phase %s", 
-                handler_name, phase->name);
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_HANDLER_STATE, AXIS2_FAILURE);
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+            "Invalid Handler State for the handler %s within the phase %s", handler_name,
+            phase->name);
         return AXIS2_FAILURE;
     }
 
     type = _axis2_phase_get_before_after(handler, env);
 
-    switch (type)
+    switch(type)
     {
-    case 0:                    /*AXIS2_BOTH_BEFORE_AFTER: */
-        status = axis2_phase_insert_before_and_after(phase, env, handler);
-        break;
-    case 1:                    /*AXIS2_BEFORE: */
-        status = axis2_phase_insert_before(phase, env, handler);
-        break;
-    case 2:                    /*AXIS2_AFTER: */
-        status = axis2_phase_insert_after(phase, env, handler);
-        break;
-    case 3:                    /*AXIS2_ANYWHERE: */
-        status = axis2_phase_add_unique(env, phase->handlers, handler);
-        break;
-    default:
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
-            "Handler description %s insertion failed within the phase %s", 
-                handler_desc_name, phase->name);
-        status = AXIS2_FAILURE;
-        break;
+        case 0: /*AXIS2_BOTH_BEFORE_AFTER: */
+            status = axis2_phase_insert_before_and_after(phase, env, handler);
+            break;
+        case 1: /*AXIS2_BEFORE: */
+            status = axis2_phase_insert_before(phase, env, handler);
+            break;
+        case 2: /*AXIS2_AFTER: */
+            status = axis2_phase_insert_after(phase, env, handler);
+            break;
+        case 3: /*AXIS2_ANYWHERE: */
+            status = axis2_phase_add_unique(env, phase->handlers, handler);
+            break;
+        default:
+            AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+                "Handler description %s insertion failed within the phase %s", handler_desc_name,
+                phase->name);
+            status = AXIS2_FAILURE;
+            break;
     }
     return status;
 }
@@ -1213,32 +1114,29 @@
     const int paused_handler_index,
     axis2_msg_ctx_t * msg_ctx)
 {
-    int i = 0,
-        size = 0;
+    int i = 0, size = 0;
     axis2_status_t status = AXIS2_SUCCESS;
 
     axis2_msg_ctx_set_paused_phase_name(msg_ctx, env, phase->name);
 
     size = axutil_array_list_size(phase->handlers, env);
-    for (i = paused_handler_index; i < size; i++)
+    for(i = paused_handler_index; i < size; i++)
     {
         axis2_handler_t *handler =
-            (axis2_handler_t *) axutil_array_list_get(phase->handlers, env, i);
-        if (handler)
+            (axis2_handler_t *)axutil_array_list_get(phase->handlers, env, i);
+        if(handler)
         {
-            const axis2_char_t *handler_name = axutil_string_get_buffer(
-                axis2_handler_get_name(handler, env), env);
+            const axis2_char_t *handler_name = axutil_string_get_buffer(axis2_handler_get_name(
+                handler, env), env);
             int index = -1;
 
-            axis2_handler_desc_t *handler_desc =
-                axis2_handler_get_handler_desc(handler, env);
-            if (!handler_desc)
+            axis2_handler_desc_t *handler_desc = axis2_handler_get_handler_desc(handler, env);
+            if(!handler_desc)
             {
-                AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_HANDLER_STATE,
-                                AXIS2_FAILURE);
-                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
-                    "Invalid Handler State for the handler %s within phase %s", 
-                        handler_name, phase->name);
+                AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_HANDLER_STATE, AXIS2_FAILURE);
+                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+                    "Invalid Handler State for the handler %s within phase %s", handler_name,
+                    phase->name);
                 return AXIS2_FAILURE;
             }
 
@@ -1255,17 +1153,17 @@
     axis2_phase_t * phase,
     const axutil_env_t * env)
 {
-    if (--(phase->ref) > 0)
+    if(--(phase->ref) > 0)
     {
         return;
     }
 
-    if (phase->name)
+    if(phase->name)
     {
         AXIS2_FREE(env->allocator, phase->name);
     }
 
-    if (phase->handlers)
+    if(phase->handlers)
     {
         axutil_array_list_free(phase->handlers, env);
     }
@@ -1280,16 +1178,15 @@
     axis2_handler_desc_t * handler_desc)
 {
     axis2_handler_t *handler;
-    const axis2_char_t *handler_desc_name = axutil_string_get_buffer(
-        axis2_handler_desc_get_name(handler_desc, env), env);
+    const axis2_char_t *handler_desc_name = axutil_string_get_buffer(axis2_handler_desc_get_name(
+        handler_desc, env), env);
     handler = axis2_handler_desc_get_handler(handler_desc, env);
-    if (!handler)
+    if(!handler)
     {
-        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_NULL_PARAM,
-                        AXIS2_FAILURE);
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, 
-            "Handler is not set in the Handler Description %s within phase %s", 
-                handler_desc_name, phase->name);
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_NULL_PARAM, AXIS2_FAILURE);
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+            "Handler is not set in the Handler Description %s within phase %s", handler_desc_name,
+            phase->name);
         return AXIS2_FAILURE;
     }
     return axis2_phase_remove_unique(env, phase->handlers, handler);
@@ -1301,33 +1198,32 @@
     axutil_array_list_t * list,
     axis2_handler_t * handler)
 {
-    int i = 0,
-        size = 0;
+    int i = 0, size = 0;
     axis2_bool_t add_handler = AXIS2_TRUE;
     const axutil_string_t *handler_name = NULL;
 
     handler_name = axis2_handler_get_name(handler, env);
     size = axutil_array_list_size(list, env);
-    for (i = 0; i < size; i++)
+    for(i = 0; i < size; i++)
     {
         axis2_handler_t *obj = NULL;
         const axutil_string_t *obj_name = NULL;
 
-        obj = (axis2_handler_t *) axutil_array_list_get(list, env, i);
+        obj = (axis2_handler_t *)axutil_array_list_get(list, env, i);
         obj_name = axis2_handler_get_name(obj, env);
-        if (obj == handler)
+        if(obj == handler)
         {
             add_handler = AXIS2_FALSE;
             break;
         }
-        else if (!axutil_strcmp(axutil_string_get_buffer(handler_name, env),
-                                    axutil_string_get_buffer(obj_name, env)))
+        else if(!axutil_strcmp(axutil_string_get_buffer(handler_name, env),
+            axutil_string_get_buffer(obj_name, env)))
         {
             add_handler = AXIS2_FALSE;
             break;
         }
     }
-    if (add_handler)
+    if(add_handler)
         axutil_array_list_add(list, env, handler);
     return AXIS2_SUCCESS;
 }
@@ -1338,33 +1234,32 @@
     axutil_array_list_t * list,
     axis2_handler_t * handler)
 {
-    int i = 0,
-        size = 0;
+    int i = 0, size = 0;
     axis2_bool_t remove_handler = AXIS2_FALSE;
     const axutil_string_t *handler_name = NULL;
 
     handler_name = axis2_handler_get_name(handler, env);
     size = axutil_array_list_size(list, env);
-    for (i = 0; i < size; i++)
+    for(i = 0; i < size; i++)
     {
         axis2_handler_t *obj = NULL;
         const axutil_string_t *obj_name = NULL;
 
-        obj = (axis2_handler_t *) axutil_array_list_get(list, env, i);
+        obj = (axis2_handler_t *)axutil_array_list_get(list, env, i);
         obj_name = axis2_handler_get_name(obj, env);
-        if (obj == handler)
+        if(obj == handler)
         {
             remove_handler = AXIS2_TRUE;
             break;
         }
-        else if (!axutil_strcmp(axutil_string_get_buffer(handler_name, env),
-                                axutil_string_get_buffer(obj_name, env)))
+        else if(!axutil_strcmp(axutil_string_get_buffer(handler_name, env),
+            axutil_string_get_buffer(obj_name, env)))
         {
             remove_handler = AXIS2_TRUE;
             break;
         }
     }
-    if (remove_handler)
+    if(remove_handler)
         axutil_array_list_remove(list, env, i);
     return AXIS2_SUCCESS;
 }

Modified: webservices/axis2/trunk/c/src/core/engine/req_uri_disp.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/engine/req_uri_disp.c?rev=805347&r1=805346&r2=805347&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/engine/req_uri_disp.c (original)
+++ webservices/axis2/trunk/c/src/core/engine/req_uri_disp.c Tue Aug 18 10:15:49 2009
@@ -1,4 +1,3 @@
-
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -28,7 +27,8 @@
 
 const axis2_char_t *AXIS2_REQ_URI_DISP_NAME = "request_uri_based_dispatcher";
 
-axis2_status_t AXIS2_CALL axis2_req_uri_disp_invoke(
+axis2_status_t AXIS2_CALL
+axis2_req_uri_disp_invoke(
     axis2_handler_t * handler,
     const axutil_env_t * env,
     struct axis2_msg_ctx *msg_ctx);
@@ -50,22 +50,19 @@
     axis2_handler_t *handler = NULL;
     axutil_string_t *name = NULL;
 
-    name = axutil_string_create_const(env,
-                                      (axis2_char_t **) &
-                                      AXIS2_REQ_URI_DISP_NAME);
+    name = axutil_string_create_const(env, (axis2_char_t **)&AXIS2_REQ_URI_DISP_NAME);
 
     disp = axis2_disp_create(env, name);
-    if (!disp)
+    if(!disp)
     {
         AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
         return NULL;
     }
 
     handler = axis2_disp_get_base(disp, env);
-    if (!handler)
+    if(!handler)
     {
-        AXIS2_ERROR_SET(env->error,
-                        AXIS2_ERROR_INVALID_HANDLER_STATE, AXIS2_FAILURE);
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_HANDLER_STATE, AXIS2_FAILURE);
         return NULL;
     }
 
@@ -84,47 +81,46 @@
     axis2_endpoint_ref_t *endpoint_ref = NULL;
     axis2_svc_t *svc = NULL;
 
-    if (axis2_msg_ctx_get_doing_rest(msg_ctx, env))
+    if(axis2_msg_ctx_get_doing_rest(msg_ctx, env))
         return NULL;
 
     endpoint_ref = axis2_msg_ctx_get_to(msg_ctx, env);
 
-    if (endpoint_ref)
+    if(endpoint_ref)
     {
         const axis2_char_t *address = NULL;
 
         address = axis2_endpoint_ref_get_address(endpoint_ref, env);
-        if (address)
+        if(address)
         {
             axis2_char_t **url_tokens = NULL;
             AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI,
-                            "Checking for service using target endpoint address : %s",
-                            address);
+                "Checking for service using target endpoint address : %s", address);
 
             url_tokens = axutil_parse_request_url_for_svc_and_op(env, address);
 
-            if (url_tokens)
+            if(url_tokens)
             {
-                if (url_tokens[0])
+                if(url_tokens[0])
                 {
                     axis2_conf_ctx_t *conf_ctx = NULL;
 
                     conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env);
-                    if (conf_ctx)
+                    if(conf_ctx)
                     {
                         axis2_conf_t *conf = NULL;
                         conf = axis2_conf_ctx_get_conf(conf_ctx, env);
-                        if (conf)
+                        if(conf)
                         {
                             svc = axis2_conf_get_svc(conf, env, url_tokens[0]);
-                            if (svc)
+                            if(svc)
                                 AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI,
-                                                "Service found using target endpoint address");
+                                    "Service found using target endpoint address");
                         }
                     }
                     AXIS2_FREE(env->allocator, url_tokens[0]);
 
-                    if (url_tokens[1])
+                    if(url_tokens[1])
                     {
                         AXIS2_FREE(env->allocator, url_tokens[1]);
                     }
@@ -150,43 +146,44 @@
 
     AXIS2_PARAM_CHECK(env->error, svc, NULL);
 
-    if (axis2_msg_ctx_get_doing_rest(msg_ctx, env))
+    if(axis2_msg_ctx_get_doing_rest(msg_ctx, env))
         return NULL;
 
     endpoint_ref = axis2_msg_ctx_get_to(msg_ctx, env);
 
-    if (endpoint_ref)
+    if(endpoint_ref)
     {
         const axis2_char_t *address = NULL;
 
         address = axis2_endpoint_ref_get_address(endpoint_ref, env);
-        if (address)
+        if(address)
         {
             axis2_char_t **url_tokens = NULL;
 
             url_tokens = axutil_parse_request_url_for_svc_and_op(env, address);
 
-            if (url_tokens)
+            if(url_tokens)
             {
-                if (url_tokens[1])
+                if(url_tokens[1])
                 {
                     axutil_qname_t *op_qname = NULL;
-                    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI,
-                                    "Checking for operation using \
-                             target endpoint uri fragment : %s", url_tokens[1]);
-                    op_qname =
-                        axutil_qname_create(env, url_tokens[1], NULL, NULL);
-                    op = axis2_svc_get_op_with_name(svc, env,
-                                                    axutil_qname_get_localpart
-                                                    (op_qname, env));
+                    AXIS2_LOG_DEBUG(
+                        env->log,
+                        AXIS2_LOG_SI,
+                        "Checking for operation using \
+                             target endpoint uri fragment : %s",
+                        url_tokens[1]);
+                    op_qname = axutil_qname_create(env, url_tokens[1], NULL, NULL);
+                    op = axis2_svc_get_op_with_name(svc, env, axutil_qname_get_localpart(op_qname,
+                        env));
                     axutil_qname_free(op_qname, env);
-                    if (op)
+                    if(op)
                         AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI,
-                                        "Operation found using target endpoint uri fragment");
+                            "Operation found using target endpoint uri fragment");
                 }
-                if (url_tokens[0])
+                if(url_tokens[0])
                     AXIS2_FREE(env->allocator, url_tokens[0]);
-                if (url_tokens[1])
+                if(url_tokens[1])
                     AXIS2_FREE(env->allocator, url_tokens[1]);
                 AXIS2_FREE(env->allocator, url_tokens);
             }

Modified: webservices/axis2/trunk/c/src/core/engine/rest_disp.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/engine/rest_disp.c?rev=805347&r1=805346&r2=805347&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/engine/rest_disp.c (original)
+++ webservices/axis2/trunk/c/src/core/engine/rest_disp.c Tue Aug 18 10:15:49 2009
@@ -33,7 +33,8 @@
 
 const axis2_char_t *AXIS2_REST_DISP_NAME = "rest_dispatcher";
 
-axis2_status_t AXIS2_CALL axis2_rest_disp_invoke(
+axis2_status_t AXIS2_CALL
+axis2_rest_disp_invoke(
     axis2_handler_t * handler,
     const axutil_env_t * env,
     struct axis2_msg_ctx *msg_ctx);
@@ -64,22 +65,19 @@
     axis2_handler_t *handler = NULL;
     axutil_string_t *name = NULL;
 
-    name = axutil_string_create_const(env,
-                                      (axis2_char_t **) &
-                                      AXIS2_REST_DISP_NAME);
+    name = axutil_string_create_const(env, (axis2_char_t **)&AXIS2_REST_DISP_NAME);
 
     disp = axis2_disp_create(env, name);
-    if (!disp)
+    if(!disp)
     {
         AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
         return NULL;
     }
 
     handler = axis2_disp_get_base(disp, env);
-    if (!handler)
+    if(!handler)
     {
-        AXIS2_ERROR_SET(env->error,
-                        AXIS2_ERROR_INVALID_HANDLER_STATE, AXIS2_FAILURE);
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_HANDLER_STATE, AXIS2_FAILURE);
         return NULL;
     }
 
@@ -98,47 +96,46 @@
     axis2_endpoint_ref_t *endpoint_ref = NULL;
     axis2_svc_t *svc = NULL;
 
-    if (!axis2_msg_ctx_get_doing_rest(msg_ctx, env))
+    if(!axis2_msg_ctx_get_doing_rest(msg_ctx, env))
         return NULL;
 
     endpoint_ref = axis2_msg_ctx_get_to(msg_ctx, env);
 
-    if (endpoint_ref)
+    if(endpoint_ref)
     {
         const axis2_char_t *address = NULL;
 
         address = axis2_endpoint_ref_get_address(endpoint_ref, env);
-        if (address)
+        if(address)
         {
             axis2_char_t **url_tokens = NULL;
             AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI,
-                            "Checking for service using target endpoint address : %s",
-                            address);
+                "Checking for service using target endpoint address : %s", address);
 
             url_tokens = axutil_parse_request_url_for_svc_and_op(env, address);
 
-            if (url_tokens)
+            if(url_tokens)
             {
-                if (url_tokens[0])
+                if(url_tokens[0])
                 {
                     axis2_conf_ctx_t *conf_ctx = NULL;
 
                     conf_ctx = axis2_msg_ctx_get_conf_ctx(msg_ctx, env);
-                    if (conf_ctx)
+                    if(conf_ctx)
                     {
                         axis2_conf_t *conf = NULL;
                         conf = axis2_conf_ctx_get_conf(conf_ctx, env);
-                        if (conf)
+                        if(conf)
                         {
                             svc = axis2_conf_get_svc(conf, env, url_tokens[0]);
-                            if (svc)
+                            if(svc)
                                 AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI,
-                                                "Service found using target endpoint address");
+                                    "Service found using target endpoint address");
                         }
                     }
                     AXIS2_FREE(env->allocator, url_tokens[0]);
 
-                    if (url_tokens[1])
+                    if(url_tokens[1])
                     {
                         AXIS2_FREE(env->allocator, url_tokens[1]);
                     }
@@ -171,75 +168,74 @@
 
     axutil_array_list_t *param_keys = NULL;
     axutil_array_list_t *param_values = NULL;
-    
 
     AXIS2_PARAM_CHECK(env->error, svc, NULL);
 
-    if (!axis2_msg_ctx_get_doing_rest(msg_ctx, env))
+    if(!axis2_msg_ctx_get_doing_rest(msg_ctx, env))
         return NULL;
 
     endpoint_ref = axis2_msg_ctx_get_to(msg_ctx, env);
 
-    if (endpoint_ref)
+    if(endpoint_ref)
     {
         const axis2_char_t *address = NULL;
 
         address = axis2_endpoint_ref_get_address(endpoint_ref, env);
-        if (address)
+        if(address)
         {
             axis2_char_t **url_tokens = NULL;
 
             url_tokens = axutil_parse_request_url_for_svc_and_op(env, address);
 
-            if (url_tokens)
+            if(url_tokens)
             {
-                if (url_tokens[0])
+                if(url_tokens[0])
                 {
                     axis2_char_t *location = NULL;
 
                     location = strstr(address, url_tokens[0]);
-                    if (location)
+                    if(location)
                     {
                         const axis2_char_t *method = NULL;
-                        
+
                         location += strlen(url_tokens[0]);
                         param_keys = axutil_array_list_create(env, 10);
                         if(!param_keys)
                         {
                             AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
                             AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-                                    "No memory. Cannot create the live rest parameter maps");
+                                "No memory. Cannot create the live rest parameter maps");
                             return NULL;
                         }
                         param_values = axutil_array_list_create(env, 10);
-     
+
                         if(!param_values)
                         {
                             axutil_array_list_free(param_keys, env);
                             AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
                             AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-                                    "No memory. Cannot create the live rest parameter maps");
+                                "No memory. Cannot create the live rest parameter maps");
                             return NULL;
                         }
                         method = axis2_msg_ctx_get_rest_http_method(msg_ctx, env);
-                        op = axis2_core_utils_get_rest_op_with_method_and_location(svc,
-                                   env, method, location, param_keys, param_values);
+                        op = axis2_core_utils_get_rest_op_with_method_and_location(svc, env,
+                            method, location, param_keys, param_values);
                     }
                 }
-                if (url_tokens[0])
+                if(url_tokens[0])
                     AXIS2_FREE(env->allocator, url_tokens[0]);
-                if (url_tokens[1])
+                if(url_tokens[1])
                     AXIS2_FREE(env->allocator, url_tokens[1]);
                 AXIS2_FREE(env->allocator, url_tokens);
             }
         }
     }
 
-    if (!op)
+    if(!op)
     {
         if(param_keys)
         {
-            for (i = 0; i < axutil_array_list_size(param_keys, env); i++)
+            for(i = 0; i < axutil_array_list_size(param_keys, env); i++)
             {
                 void *value = axutil_array_list_get(param_keys, env, i);
                 AXIS2_FREE(env->allocator, value);
@@ -248,7 +244,7 @@
         }
         if(param_values)
         {
-            for (i = 0; i < axutil_array_list_size(param_values, env); i++)
+            for(i = 0; i < axutil_array_list_size(param_values, env); i++)
             {
                 void *value = axutil_array_list_get(param_values, env, i);
                 AXIS2_FREE(env->allocator, value);
@@ -260,24 +256,22 @@
 
     soap_env = axis2_msg_ctx_get_soap_envelope(msg_ctx, env);
 
-    if (!soap_env)
+    if(!soap_env)
     {
         soap_env_exists = AXIS2_FALSE;
-        soap_env = axiom_soap_envelope_create_default_soap_envelope(env,
-                                                                    AXIOM_SOAP11);
+        soap_env = axiom_soap_envelope_create_default_soap_envelope(env, AXIOM_SOAP11);
     }
-    if (soap_env)
+    if(soap_env)
     {
         soap_body = axiom_soap_envelope_get_body(soap_env, env);
     }
-    if (!soap_body)
+    if(!soap_body)
     {
-        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_SOAP_ENVELOPE_OR_SOAP_BODY_NULL,
-                        AXIS2_FAILURE);
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_SOAP_ENVELOPE_OR_SOAP_BODY_NULL, AXIS2_FAILURE);
 
         if(param_keys)
         {
-            for (i = 0; i < axutil_array_list_size(param_keys, env); i++)
+            for(i = 0; i < axutil_array_list_size(param_keys, env); i++)
             {
                 void *value = axutil_array_list_get(param_keys, env, i);
                 AXIS2_FREE(env->allocator, value);
@@ -286,7 +280,7 @@
         }
         if(param_values)
         {
-            for (i = 0; i < axutil_array_list_size(param_values, env); i++)
+            for(i = 0; i < axutil_array_list_size(param_values, env); i++)
             {
                 void *value = axutil_array_list_get(param_values, env, i);
                 AXIS2_FREE(env->allocator, value);
@@ -298,22 +292,21 @@
 
     body_element_node = axiom_soap_body_get_base_node(soap_body, env);
 
-    if (body_element_node)
+    if(body_element_node)
     {
         body_child_node = axiom_node_get_first_child(body_element_node, env);
     }
 
-    if (!body_child_node)
+    if(!body_child_node)
     {
-        body_child = axiom_element_create_with_qname(env, NULL,
-                                                     axis2_op_get_qname(
-                                                      op, env),
-                                                     &body_child_node);
+        body_child = axiom_element_create_with_qname(env, NULL, axis2_op_get_qname(op, env),
+            &body_child_node);
         axiom_soap_body_add_child(soap_body, env, body_child_node);
     }
-   
-    if(param_keys && param_values) {
-        for (i = 0; i < axutil_array_list_size(param_keys, env); i++)
+
+    if(param_keys && param_values)
+    {
+        for(i = 0; i < axutil_array_list_size(param_keys, env); i++)
         {
             axis2_char_t *param_key = NULL;
             axis2_char_t *param_value = NULL;
@@ -324,8 +317,7 @@
             param_key = axutil_array_list_get(param_keys, env, i);
             param_value = axutil_array_list_get(param_values, env, i);
 
-            element = axiom_element_create(env, NULL, param_key,
-                                           NULL, &node);
+            element = axiom_element_create(env, NULL, param_key, NULL, &node);
             axiom_element_set_text(element, env, param_value, node);
             axiom_node_add_child(body_child_node, env, node);
 
@@ -337,7 +329,7 @@
         axutil_array_list_free(param_values, env);
     }
 
-    if (!soap_env_exists)
+    if(!soap_env_exists)
     {
         axis2_msg_ctx_set_soap_envelope(msg_ctx, env, soap_env);
     }

Modified: webservices/axis2/trunk/c/src/core/engine/soap_action_disp.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/engine/soap_action_disp.c?rev=805347&r1=805346&r2=805347&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/engine/soap_action_disp.c (original)
+++ webservices/axis2/trunk/c/src/core/engine/soap_action_disp.c Tue Aug 18 10:15:49 2009
@@ -1,4 +1,3 @@
-
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -26,10 +25,10 @@
 #include <axis2_addr.h>
 #include <axutil_utils.h>
 
-const axis2_char_t *AXIS2_SOAP_ACTION_DISP_NAME =
-    "soap_action_based_dispatcher";
+const axis2_char_t *AXIS2_SOAP_ACTION_DISP_NAME = "soap_action_based_dispatcher";
 
-axis2_status_t AXIS2_CALL axis2_soap_action_disp_invoke(
+axis2_status_t AXIS2_CALL
+axis2_soap_action_disp_invoke(
     axis2_handler_t * handler,
     const axutil_env_t * env,
     struct axis2_msg_ctx *msg_ctx);
@@ -51,22 +50,19 @@
     axis2_handler_t *handler = NULL;
     axutil_string_t *name = NULL;
 
-    name = axutil_string_create_const(env,
-                                      (axis2_char_t **) &
-                                      AXIS2_SOAP_ACTION_DISP_NAME);
+    name = axutil_string_create_const(env, (axis2_char_t **)&AXIS2_SOAP_ACTION_DISP_NAME);
 
     disp = axis2_disp_create(env, name);
-    if (!disp)
+    if(!disp)
     {
         AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
         return NULL;
     }
 
     handler = axis2_disp_get_base(disp, env);
-    if (!handler)
+    if(!handler)
     {
-        AXIS2_ERROR_SET(env->error,
-                        AXIS2_ERROR_INVALID_HANDLER_STATE, AXIS2_FAILURE);
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_HANDLER_STATE, AXIS2_FAILURE);
         return NULL;
     }
 
@@ -82,12 +78,11 @@
     axis2_msg_ctx_t * msg_ctx,
     const axutil_env_t * env)
 {
-    if (axis2_msg_ctx_get_doing_rest(msg_ctx, env))
+    if(axis2_msg_ctx_get_doing_rest(msg_ctx, env))
         return NULL;
 
-    AXIS2_LOG_DEBUG(env->log,
-                    AXIS2_LOG_SI,
-                    "Checking for service using SOAPAction is not implemented");
+    AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI,
+        "Checking for service using SOAPAction is not implemented");
     return NULL;
 }
 
@@ -103,24 +98,22 @@
 
     AXIS2_PARAM_CHECK(env->error, svc, NULL);
 
-    if (axis2_msg_ctx_get_doing_rest(msg_ctx, env))
+    if(axis2_msg_ctx_get_doing_rest(msg_ctx, env))
         return NULL;
 
-    action =
-        axutil_string_get_buffer(axis2_msg_ctx_get_soap_action(msg_ctx, env),
-                                 env);
+    action = axutil_string_get_buffer(axis2_msg_ctx_get_soap_action(msg_ctx, env), env);
 
-    if (action)
+    if(action)
     {
-        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI,
-                        "Checking for operation using SOAPAction : %s", action);
+        AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "Checking for operation using SOAPAction : %s",
+            action);
 
-        if (!op)
+        if(!op)
         {
             const axis2_char_t *op_name = NULL;
             op_name = axutil_rindex(action, '/');
 
-            if (op_name)
+            if(op_name)
             {
                 op_name += 1;
             }
@@ -129,22 +122,21 @@
                 op_name = action;
             }
 
-            if (op_name)
+            if(op_name)
             {
                 op = axis2_svc_get_op_with_name(svc, env, op_name);
             }
         }
-        
-        if (!op)
+
+        if(!op)
         {
             name = axutil_qname_create(env, action, NULL, NULL);
             op = axis2_svc_get_op_with_qname(svc, env, name);
             axutil_qname_free(name, env);
         }
 
-        if (op)
-            AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI,
-                            "Operation found using SOAPAction");
+        if(op)
+            AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "Operation found using SOAPAction");
     }
     return op;
 }