You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by di...@apache.org on 2008/03/31 11:40:50 UTC

svn commit: r642940 - in /webservices/axis2/trunk/c: include/axis2_http_transport.h src/core/transport/http/common/http_response_writer.c src/core/transport/http/common/http_simple_request.c src/core/transport/http/common/http_simple_response.c

Author: dinesh
Date: Mon Mar 31 02:40:48 2008
New Revision: 642940

URL: http://svn.apache.org/viewvc?rev=642940&view=rev
Log:
added more log messages, replaced strings with macros and corrected log levels.

Modified:
    webservices/axis2/trunk/c/include/axis2_http_transport.h
    webservices/axis2/trunk/c/src/core/transport/http/common/http_response_writer.c
    webservices/axis2/trunk/c/src/core/transport/http/common/http_simple_request.c
    webservices/axis2/trunk/c/src/core/transport/http/common/http_simple_response.c

Modified: webservices/axis2/trunk/c/include/axis2_http_transport.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/include/axis2_http_transport.h?rev=642940&r1=642939&r2=642940&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_http_transport.h (original)
+++ webservices/axis2/trunk/c/include/axis2_http_transport.h Mon Mar 31 02:40:48 2008
@@ -1012,6 +1012,8 @@
 #define AXIS2_RETURN '\r'
 
 #define AXIS2_F_SLASH '/'
+
+#define AXIS2_EQ '='
     /** @} */
 
 #ifdef __cplusplus

Modified: webservices/axis2/trunk/c/src/core/transport/http/common/http_response_writer.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/http/common/http_response_writer.c?rev=642940&r1=642939&r2=642940&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/http/common/http_response_writer.c (original)
+++ webservices/axis2/trunk/c/src/core/transport/http/common/http_response_writer.c Mon Mar 31 02:40:48 2008
@@ -32,7 +32,6 @@
     const axutil_env_t * env,
     axutil_stream_t * stream)
 {
-    AXIS2_ENV_CHECK(env, NULL);
     return axis2_http_response_writer_create_with_encoding(env, stream,
                                                            AXIS2_HTTP_DEFAULT_CONTENT_CHARSET);
 
@@ -45,7 +44,7 @@
     const axis2_char_t * encoding)
 {
     axis2_http_response_writer_t *response_writer = NULL;
-    AXIS2_ENV_CHECK(env, NULL);
+
     AXIS2_PARAM_CHECK(env->error, encoding, NULL);
 
     response_writer = (axis2_http_response_writer_t *) AXIS2_MALLOC
@@ -53,9 +52,10 @@
 
     if (!response_writer)
     {
-        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
         return NULL;
     }
+    memset ((void *)response_writer, 0, sizeof (axis2_http_response_writer_t));
     response_writer->stream = stream;
     response_writer->encoding = (axis2_char_t *) axutil_strdup(env, encoding);
 
@@ -67,9 +67,12 @@
     axis2_http_response_writer_t * response_writer,
     const axutil_env_t * env)
 {
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-    AXIS2_FREE(env->allocator, response_writer->encoding);
+    if (!response_writer)
+    {
+        return;
+    }
 
+    AXIS2_FREE(env->allocator, response_writer->encoding);
     AXIS2_FREE(env->allocator, response_writer);
 
     return;
@@ -80,36 +83,17 @@
     const axis2_http_response_writer_t * response_writer,
     const axutil_env_t * env)
 {
-    AXIS2_ENV_CHECK(env, NULL);
     return response_writer->encoding;
 }
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
-axis2_http_response_writer_close(
-    axis2_http_response_writer_t * response_writer,
-    const axutil_env_t * env)
-{
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-    return AXIS2_SUCCESS;
-}
-
-AXIS2_EXTERN axis2_status_t AXIS2_CALL
-axis2_http_response_writer_flush(
-    axis2_http_response_writer_t * response_writer,
-    const axutil_env_t * env)
-{
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-    return AXIS2_FALSE;
-}
-
-AXIS2_EXTERN axis2_status_t AXIS2_CALL
 axis2_http_response_writer_write_char(
     axis2_http_response_writer_t * response_writer,
     const axutil_env_t * env,
     char c)
 {
     int write = -1;
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    AXIS2_PARAM_CHECK(env->error, response_writer, AXIS2_FAILURE);
 
     if (!response_writer->stream)
     {
@@ -132,7 +116,8 @@
     axis2_ssize_t len)
 {
     int write = -1;
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
+    AXIS2_PARAM_CHECK(env->error, response_writer, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK(env->error, buf, AXIS2_FAILURE);
 
     if (!response_writer->stream)
@@ -156,7 +141,7 @@
     int write = -1;
     int len = -1;
 
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+    AXIS2_PARAM_CHECK(env->error, response_writer, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK(env->error, str, AXIS2_FAILURE);
 
     len = axutil_strlen(str);
@@ -165,10 +150,14 @@
         return AXIS2_FAILURE;
     }
     write = axutil_stream_write(response_writer->stream, env, str, len);
+
     if (write < 0)
     {
+        AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI, "failed to write to stream\
+string %s of length %d", str, len);
         return AXIS2_FAILURE;
     }
+
     return AXIS2_SUCCESS;
 }
 
@@ -179,7 +168,6 @@
     int i)
 {
     axis2_char_t int_str[10];
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     sprintf(int_str, "%10d", i);
     return axis2_http_response_writer_print_str(response_writer, env, int_str);
 }
@@ -190,7 +178,6 @@
     const axutil_env_t * env,
     const char *str)
 {
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK(env->error, str, AXIS2_FAILURE);
 
     if (AXIS2_SUCCESS == axis2_http_response_writer_print_str(response_writer,
@@ -207,7 +194,6 @@
     axis2_http_response_writer_t * response_writer,
     const axutil_env_t * env)
 {
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     return axis2_http_response_writer_print_str(response_writer, env,
                                                 AXIS2_HTTP_CRLF);
 }

Modified: webservices/axis2/trunk/c/src/core/transport/http/common/http_simple_request.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/http/common/http_simple_request.c?rev=642940&r1=642939&r2=642940&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/http/common/http_simple_request.c (original)
+++ webservices/axis2/trunk/c/src/core/transport/http/common/http_simple_request.c Mon Mar 31 02:40:48 2008
@@ -40,17 +40,16 @@
     axutil_stream_t * content)
 {
     axis2_http_simple_request_t *simple_request = NULL;
-    AXIS2_ENV_CHECK(env, NULL);
-    AXIS2_ENV_CHECK(env, NULL);
 
     simple_request = (axis2_http_simple_request_t *) AXIS2_MALLOC
         (env->allocator, sizeof(axis2_http_simple_request_t));
 
     if (!simple_request)
     {
-        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
         return NULL;
     }
+    memset ((void *)simple_request, 0, sizeof (axis2_http_simple_request_t));
     simple_request->request_line = request_line;
     simple_request->stream = content;
     simple_request->header_group = NULL;
@@ -63,13 +62,13 @@
         {
             axis2_http_simple_request_free((axis2_http_simple_request_t *)
                                            simple_request, env);
-            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+            AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
             return NULL;
         }
         simple_request->owns_stream = AXIS2_TRUE;
     }
 
-    if (http_hdr_count > 0 && http_headers)
+    if ((http_hdr_count > 0) && http_headers)
     {
         int i = 0;
         simple_request->header_group = axutil_array_list_create(env,
@@ -91,7 +90,10 @@
     axis2_http_simple_request_t * simple_request,
     const axutil_env_t * env)
 {
-    AXIS2_ENV_CHECK(env, void);
+    if (!simple_request)
+    {
+        return;
+    }
 
     if (AXIS2_TRUE == simple_request->owns_stream)
     {
@@ -100,10 +102,12 @@
     /*
        Don't free the stream since it belongs to the socket
      */
+
     if (simple_request->request_line)
     {
         axis2_http_request_line_free(simple_request->request_line, env);
     }
+
     if (simple_request->header_group)
     {
         int i = 0;
@@ -120,12 +124,12 @@
         }
         axutil_array_list_free(simple_request->header_group, env);
     }
-
     AXIS2_FREE(env->allocator, simple_request);
 
     return;
 }
 
+
 AXIS2_EXTERN axis2_http_request_line_t *AXIS2_CALL
 axis2_http_simple_request_get_request_line(
     const axis2_http_simple_request_t * simple_request,
@@ -134,18 +138,19 @@
     return simple_request->request_line;
 }
 
+
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 axis2_http_simple_request_set_request_line(
     axis2_http_simple_request_t * simple_request,
     const axutil_env_t * env,
     axis2_http_request_line_t * request_line)
 {
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK(env->error, request_line, AXIS2_FAILURE);
     simple_request->request_line = request_line;
     return AXIS2_SUCCESS;
 }
 
+
 AXIS2_EXTERN axis2_bool_t AXIS2_CALL
 axis2_http_simple_request_contains_header(
     axis2_http_simple_request_t * simple_request,
@@ -156,11 +161,12 @@
     axis2_char_t *header_name = NULL;
     int count = 0;
 
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK(env->error, name, AXIS2_FAILURE);
 
     if (!simple_request->header_group)
     {
+        AXIS2_LOG_WARNING (env->log, AXIS2_LOG_SI, "http simple request \
+does not contain headers, unable to find: %s header", name);
         return AXIS2_FALSE;
     }
 
@@ -168,6 +174,8 @@
 
     if (0 == count)
     {
+        AXIS2_LOG_WARNING (env->log, AXIS2_LOG_SI, "http simple request \
+contains zero headers, unable to find: %s header", name);
         return AXIS2_FALSE;
     }
 
@@ -178,11 +186,14 @@
                                                  (simple_request->header_group,
                                                   env, i), env);
         if (0 == axutil_strcasecmp(name, header_name))
+        {
             return AXIS2_TRUE;
+        }
     }
     return AXIS2_FALSE;
 }
 
+
 AXIS2_EXTERN axutil_array_list_t *AXIS2_CALL
 axis2_http_simple_request_get_headers(
     const axis2_http_simple_request_t * simple_request,
@@ -191,6 +202,7 @@
     return simple_request->header_group;
 }
 
+
 AXIS2_EXTERN axis2_http_header_t *AXIS2_CALL
 axis2_http_simple_request_get_first_header(
     const axis2_http_simple_request_t * simple_request,
@@ -203,16 +215,19 @@
     axis2_http_header_t *tmp_header = NULL;
     axis2_char_t *tmp_name = NULL;
 
-    AXIS2_ENV_CHECK(env, NULL);
     AXIS2_PARAM_CHECK(env->error, str, NULL);
 
     header_group = simple_request->header_group;
     if (!simple_request->header_group)
     {
+        AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI, "http simple request \
+does not contain headers, unable to find: %s header", str);
         return NULL;
     }
     if (0 == axutil_array_list_size(header_group, env))
     {
+        AXIS2_LOG_WARNING (env->log, AXIS2_LOG_SI, "http simple request \
+ contain zero headers, unable to find: %s header", str);
         return NULL;
     }
 
@@ -232,6 +247,7 @@
     return NULL;
 }
 
+
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 axis2_http_simple_request_remove_headers(
     axis2_http_simple_request_t * simple_request,
@@ -244,7 +260,6 @@
     int count = 0;
     axutil_array_list_t *header_group = NULL;
 
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK(env->error, str, AXIS2_FAILURE);
 
     header_group = simple_request->header_group;
@@ -275,13 +290,13 @@
     return AXIS2_SUCCESS;
 }
 
+
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 axis2_http_simple_request_add_header(
     axis2_http_simple_request_t * simple_request,
     const axutil_env_t * env,
     axis2_http_header_t * header)
 {
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK(env->error, header, AXIS2_FAILURE);
 
     if (!simple_request->header_group)
@@ -291,28 +306,32 @@
     return axutil_array_list_add(simple_request->header_group, env, header);
 }
 
+
 AXIS2_EXTERN const axis2_char_t *AXIS2_CALL
 axis2_http_simple_request_get_content_type(
     const axis2_http_simple_request_t * simple_request,
     const axutil_env_t * env)
 {
     axis2_http_header_t *tmp_header = NULL;
-    AXIS2_ENV_CHECK(env, NULL);
+
     tmp_header = axis2_http_simple_request_get_first_header
         (simple_request, env, AXIS2_HTTP_HEADER_CONTENT_TYPE);
     if (tmp_header)
+    {
         return axis2_http_header_get_value(tmp_header, env);
+    }
 
     return AXIS2_HTTP_HEADER_ACCEPT_TEXT_PLAIN;
 }
 
+
 AXIS2_EXTERN const axis2_char_t *AXIS2_CALL
 axis2_http_simple_request_get_charset(
     const axis2_http_simple_request_t * simple_request,
     const axutil_env_t * env)
 {
     axis2_http_header_t *tmp_header = NULL;
-    AXIS2_ENV_CHECK(env, NULL);
+
     tmp_header = axis2_http_simple_request_get_first_header
         (simple_request, env, AXIS2_HTTP_HEADER_CONTENT_TYPE);
     if (tmp_header)
@@ -323,7 +342,7 @@
                                                         AXIS2_HTTP_CHAR_SET_ENCODING);
         if (charset)
         {
-            charset = strchr((char *) charset, '=');
+            charset = strchr((char *) charset, AXIS2_EQ);
             return charset;
         }
     }
@@ -331,6 +350,7 @@
     return AXIS2_HTTP_DEFAULT_CONTENT_CHARSET;
 }
 
+
 AXIS2_EXTERN axis2_ssize_t AXIS2_CALL
 axis2_http_simple_request_get_content_length(
     const axis2_http_simple_request_t * simple_request,
@@ -338,7 +358,7 @@
 {
     axis2_http_header_t *tmp_header = NULL;
     int error_return = -1;
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
     tmp_header = axis2_http_simple_request_get_first_header
         (simple_request, env, AXIS2_HTTP_HEADER_CONTENT_LENGTH);
     if (tmp_header)
@@ -356,6 +376,7 @@
     return simple_request->stream;
 }
 
+
 AXIS2_EXTERN axis2_ssize_t AXIS2_CALL
 axis2_http_simple_request_get_body_bytes(
     const axis2_http_simple_request_t * simple_request,
@@ -369,8 +390,6 @@
     int length = 0;
     int read_len = 0;
 
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-
     body = simple_request->stream;
     if (!body)
     {
@@ -378,6 +397,7 @@
         *buf[0] = '\0';
         return 0;
     }
+
     length = axis2_http_simple_request_get_content_length(simple_request, env);
     if (length > 0)
     {
@@ -385,6 +405,7 @@
         read_len = axutil_stream_read(body, env, *buf, length + 1);
         return read_len;
     }
+
     tmp_buf2 = AXIS2_MALLOC(env->allocator, 128 * sizeof(char));
     while (axutil_stream_read(body, env, tmp_buf2, 128) > 0)
     {
@@ -397,16 +418,19 @@
         tmp_buf = tmp_buf3;
 
     }
+
     if (tmp_buf)
     {
         *buf = tmp_buf;
         return axutil_strlen(tmp_buf);
     }
+
     *buf = (char *) AXIS2_MALLOC(env->allocator, 1);
-    *buf[0] = '\0';
+    *buf[0] = AXIS2_ESC_NULL;
     return 0;
 }
 
+
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 axis2_http_simple_request_set_body_string(
     axis2_http_simple_request_t * simple_request,
@@ -415,7 +439,7 @@
     unsigned int str_len)
 {
     axutil_stream_t *body_stream = NULL;
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
     AXIS2_PARAM_CHECK(env->error, str, AXIS2_FAILURE);
 
     body_stream = simple_request->stream;
@@ -424,11 +448,14 @@
         body_stream = axutil_stream_create_basic(env);
         if (!body_stream)
         {
+            AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI, "unable to create stream\
+for stream %s of %d length", (axis2_char_t *)str, str_len);
             return AXIS2_FAILURE;
         }
         simple_request->stream = body_stream;
         simple_request->owns_stream = AXIS2_TRUE;
     }
+
     axutil_stream_write(body_stream, env, str, str_len);
     return AXIS2_SUCCESS;
 }

Modified: webservices/axis2/trunk/c/src/core/transport/http/common/http_simple_response.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/src/core/transport/http/common/http_simple_response.c?rev=642940&r1=642939&r2=642940&view=diff
==============================================================================
--- webservices/axis2/trunk/c/src/core/transport/http/common/http_simple_response.c (original)
+++ webservices/axis2/trunk/c/src/core/transport/http/common/http_simple_response.c Mon Mar 31 02:40:48 2008
@@ -1,4 +1,3 @@
-
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -31,6 +30,7 @@
     axutil_stream_t *stream;
 };
 
+
 AXIS2_EXTERN axis2_http_simple_response_t *AXIS2_CALL
 axis2_http_simple_response_create(
     const axutil_env_t * env,
@@ -41,21 +41,22 @@
 {
     axis2_http_simple_response_t *ret = NULL;
     axis2_http_simple_response_t *simple_response = NULL;
-    AXIS2_ENV_CHECK(env, NULL);
-    AXIS2_ENV_CHECK(env, NULL);
 
     ret = axis2_http_simple_response_create_default(env);
     if (!ret)
     {
+        AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI, 
+                         "axis2 http simple response creation failed");
         return NULL;
     }
     simple_response = ret;
 
     if (!simple_response)
     {
-        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
         return NULL;
     }
+
     simple_response->status_line = status_line;
     if (http_hdr_count > 0 && http_headers)
     {
@@ -80,11 +81,16 @@
     const axutil_env_t * env)
 {
     axis2_http_simple_response_t *simple_response = NULL;
-    AXIS2_ENV_CHECK(env, NULL);
 
     simple_response = (axis2_http_simple_response_t *) AXIS2_MALLOC
         (env->allocator, sizeof(axis2_http_simple_response_t));
 
+    if (!simple_response)
+    {
+        AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+        return NULL;
+    }
+    memset ((void *)simple_response, 0, sizeof(axis2_http_simple_response_t));
     simple_response->status_line = NULL;
     simple_response->header_group = NULL;
     simple_response->stream = NULL;
@@ -97,12 +103,12 @@
     axis2_http_simple_response_t * simple_response,
     const axutil_env_t * env)
 {
-    AXIS2_ENV_CHECK(env, void);
 
     if (simple_response->status_line)
     {
         axis2_http_status_line_free(simple_response->status_line, env);
     }
+
     if (simple_response->header_group)
     {
         int i = 0;
@@ -139,7 +145,7 @@
     const axis2_char_t * phrase)
 {
     axis2_char_t *tmp_status_line_str = NULL;
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
     AXIS2_PARAM_CHECK(env->error, http_ver, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK(env->error, status_code, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK(env->error, phrase, AXIS2_FAILURE);
@@ -148,8 +154,15 @@
                                        (axutil_strlen(http_ver) +
                                         axutil_strlen(phrase) +
                                         8) * sizeof(axis2_char_t *));
+
+    if (!tmp_status_line_str)
+    {
+        AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+    }
+
     sprintf(tmp_status_line_str, "%s %3d %s%s", http_ver, status_code, phrase,
             AXIS2_HTTP_CRLF);
+
     if (simple_response->status_line)
     {
         axis2_http_status_line_free(simple_response->status_line, env);
@@ -161,6 +174,9 @@
 
     if (!simple_response->status_line)
     {
+        AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI, 
+                         "axis2 http status line creation failed for tmp \
+string %s", tmp_status_line_str);
         return AXIS2_FAILURE;
     }
     return AXIS2_SUCCESS;
@@ -173,8 +189,11 @@
 {
     if (!(simple_response->status_line))
     {
+        AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI, 
+                         "axis2 simple response , status line is not available");
         return NULL;
     }
+
     return axis2_http_status_line_get_reason_phrase(simple_response->
                                                     status_line, env);
 }
@@ -186,6 +205,8 @@
 {
     if (!(simple_response->status_line))
     {
+        AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI, 
+                         "axis2 simple response , status line is not available");
         return -1;
     }
     return axis2_http_status_line_get_status_code(simple_response->status_line,
@@ -199,6 +220,9 @@
 {
     if (!(simple_response->status_line))
     {
+        AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI, 
+                         "axis2 simple response , status line is not available");
+     
         return NULL;
     }
     return axis2_http_status_line_get_http_version(simple_response->status_line,
@@ -210,9 +234,12 @@
     axis2_http_simple_response_t * simple_response,
     const axutil_env_t * env)
 {
-    AXIS2_ENV_CHECK(env, NULL);
+
     if (!(simple_response->status_line))
     {
+        AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI, 
+                         "axis2 simple response , status line is not available");
+     
         return NULL;
     }
     return axis2_http_status_line_to_string(simple_response->status_line, env);
@@ -252,16 +279,21 @@
     int count = 0;
     axutil_array_list_t *header_group = NULL;
 
-    AXIS2_ENV_CHECK(env, NULL);
     AXIS2_PARAM_CHECK(env->error, str, NULL);
 
     header_group = simple_response->header_group;
     if (!simple_response->header_group)
     {
-        return NULL;
+        AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI, 
+                         "axis2 simple response , headers not available");
+             return NULL;
     }
+
     if (0 == axutil_array_list_size(header_group, env))
     {
+        AXIS2_LOG_WARNING (env->log, AXIS2_LOG_SI, 
+                         "axis2 simple response , contains zero headers");
+
         return NULL;
     }
 
@@ -293,7 +325,6 @@
     int i = 0;
     int count = 0;
 
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK(env->error, str, AXIS2_FAILURE);
 
     header_group = simple_response->header_group;
@@ -335,7 +366,6 @@
     axis2_char_t *tmp_name = NULL;
     axutil_array_list_t *header_group = NULL;
 
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK(env->error, header, AXIS2_FAILURE);
 
     if (!simple_response->header_group)
@@ -374,7 +404,7 @@
     const axutil_env_t * env)
 {
     axis2_http_header_t *tmp_header = NULL;
-    AXIS2_ENV_CHECK(env, NULL);
+
     tmp_header = axis2_http_simple_response_get_first_header
         (simple_response, env, AXIS2_HTTP_HEADER_CONTENT_TYPE);
     if (tmp_header)
@@ -385,7 +415,7 @@
                                                         AXIS2_HTTP_CHAR_SET_ENCODING);
         if (charset)
         {
-            charset = strchr((char *) charset, '=');
+            charset = strchr((char *) charset, AXIS2_EQ);
             return charset;
         }
     }
@@ -400,7 +430,7 @@
 {
     axis2_http_header_t *tmp_header = NULL;
     int error_return = -1;
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
     tmp_header = axis2_http_simple_response_get_first_header
         (simple_response, env, AXIS2_HTTP_HEADER_CONTENT_LENGTH);
     if (tmp_header)
@@ -416,11 +446,13 @@
     const axutil_env_t * env)
 {
     axis2_http_header_t *tmp_header = NULL;
-    AXIS2_ENV_CHECK(env, NULL);
+
     tmp_header = axis2_http_simple_response_get_first_header
         (simple_response, env, AXIS2_HTTP_HEADER_CONTENT_TYPE);
     if (tmp_header)
+    {
         return axis2_http_header_get_value(tmp_header, env);
+    }
 
     return AXIS2_HTTP_HEADER_ACCEPT_TEXT_PLAIN;
 }
@@ -432,7 +464,7 @@
     axis2_char_t * str)
 {
     axutil_stream_t *body_stream = NULL;
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
     AXIS2_PARAM_CHECK(env->error, str, AXIS2_FAILURE);
 
     body_stream = simple_response->stream;
@@ -441,6 +473,8 @@
         body_stream = axutil_stream_create_basic(env);
         if (!body_stream)
         {
+            AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI, 
+                             "unable to create basic stream for string %s", str);
             return AXIS2_FAILURE;
         }
         simple_response->stream = body_stream;
@@ -482,11 +516,9 @@
     axis2_bool_t loop_state = AXIS2_TRUE;
     int return_size = -1;
 
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-
     if (!simple_response->stream)
     {
-        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NULL_BODY, AXIS2_FAILURE);
+        AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_NULL_BODY, AXIS2_FAILURE);
         return return_size;
     }
     tmp_stream = axutil_stream_create_basic(env);
@@ -494,8 +526,8 @@
     {
         int read = 0;
         int write = 0;
-        /*   int AXIS2_HTTP_SIMPLE_RESPONSE_READ_SIZE = 32; */
         char buf[AXIS2_HTTP_SIMPLE_RESPONSE_READ_SIZE];
+
         read =
             axutil_stream_read(simple_response->stream, env, buf,
                                AXIS2_HTTP_SIMPLE_RESPONSE_READ_SIZE);
@@ -515,6 +547,13 @@
     {
         *buffer = (char *) AXIS2_MALLOC(env->allocator, sizeof(char) *
                                         (return_size + 1));
+
+        if (!buffer)
+        {
+            AXIS2_HANDLE_ERROR(env, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+            return -1;
+        }
+
         return_size = axutil_stream_read(tmp_stream, env, *buffer,
                                          return_size + 1);
     }
@@ -532,15 +571,19 @@
     int count = 0;
     int i = 0;
 
-    AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK(env->error, name, AXIS2_FAILURE);
     if (!simple_response->header_group)
     {
+        AXIS2_LOG_ERROR (env->log, AXIS2_LOG_SI, 
+                         "axis2 simple response , headers not available");
+
         return AXIS2_FALSE;
     }
     count = axutil_array_list_size(simple_response->header_group, env);
     if (0 == count)
     {
+        AXIS2_LOG_WARNING (env->log, AXIS2_LOG_SI, 
+                           "axis2 simple response , contains zero headers");
         return AXIS2_FALSE;
     }
 
@@ -555,3 +598,8 @@
     }
     return AXIS2_FALSE;
 }
+
+
+
+
+



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