revise error messages 25/64725/1
authorYoungjae Shin <yj99.shin@samsung.com>
Tue, 5 Apr 2016 05:59:26 +0000 (14:59 +0900)
committerYoungjae Shin <yj99.shin@samsung.com>
Tue, 5 Apr 2016 05:59:26 +0000 (14:59 +0900)
Change-Id: Iccb01e9a0e797a66633caf71546f1b5981ba9af3

daemon/icd-cynara.c
daemon/icd-dbus.c
daemon/icd-ioty-ocprocess.c
daemon/icd-ioty.c
daemon/icd-payload.c
lib/icl-list.c
lib/icl-payload.c
test/iotcon-test-basic-server.c
test/iotcon-test-encap-server.c
test/iotcon-test-iface-server.c

index e2ef6fbd71fab061d646bac0174fdcf22fb202b9..263f5f4ecf86eb3dc7ae6777eff0dd3adc82fd4a 100644 (file)
@@ -43,9 +43,7 @@ static cynara *_cynara;
 int icd_cynara_init()
 {
 #ifdef TZ_VER_3
-       int ret;
-       ret = cynara_initialize(&_cynara, NULL);
-
+       int ret = cynara_initialize(&_cynara, NULL);
        if (CYNARA_API_SUCCESS != ret) {
                ERR("cynara_initialize() Fail(%d)", ret);
                return IOTCON_ERROR_SYSTEM;
@@ -97,13 +95,13 @@ static int _icd_cynara_check(GDBusMethodInvocation *invocation, const char **pri
 
        ret = cynara_creds_gdbus_get_client(conn, sender, CLIENT_METHOD_SMACK, &client);
        if (CYNARA_API_SUCCESS != ret) {
-               ERR("cynara_creds_dbus_get_client() Fail(%d)", ret);
+               ERR("cynara_creds_gdbus_get_client() Fail(%d)", ret);
                return IOTCON_ERROR_SYSTEM;
        }
 
        ret = cynara_creds_gdbus_get_user(conn, sender, USER_METHOD_UID, &user);
        if (CYNARA_API_SUCCESS != ret) {
-               ERR("cynara_creds_dbus_get_user() Fail(%d)", ret);
+               ERR("cynara_creds_gdbus_get_user() Fail(%d)", ret);
                free(client);
                return IOTCON_ERROR_SYSTEM;
        }
index 920242739c3947e4e1b30e968713e5b4e34d1449..ca0912f1771dc47e0e676c5d49ba39f68c6e606a 100644 (file)
@@ -283,7 +283,7 @@ static int _icd_dbus_client_list_get_client(const gchar *bus_name,
 
        client = calloc(1, sizeof(icd_dbus_client_s));
        if (NULL == client) {
-               ERR("calloc(client) Fail(%d)", errno);
+               ERR("calloc() Fail(%d)", errno);
                return IOTCON_ERROR_OUT_OF_MEMORY;
        }
 
@@ -446,7 +446,7 @@ static int _icd_dbus_presence_list_add(const gchar *bus_name,
 
        presence_handle = calloc(1, sizeof(icd_presence_handle_s));
        if (NULL == presence_handle) {
-               ERR("calloc(handle) Fail(%d)", errno);
+               ERR("calloc() Fail(%d)", errno);
                return IOTCON_ERROR_OUT_OF_MEMORY;
        }
        presence_handle->handle = handle;
@@ -579,7 +579,7 @@ static int _icd_dbus_encap_list_add(const gchar *bus_name, int type,
 
        encap_handle = calloc(1, sizeof(icd_encap_handle_s));
        if (NULL == encap_handle) {
-               ERR("calloc(handle) Fail(%d)", errno);
+               ERR("calloc() Fail(%d)", errno);
                return IOTCON_ERROR_OUT_OF_MEMORY;
        }
        encap_handle->type = type;
index 72ac35fb425876edcdc24de60f6f0ed977e9360b..94c986176acdf4191ecab8ea1a5c5c3b7297a77b 100644 (file)
@@ -200,7 +200,8 @@ static int _ocprocess_response_signal(const char *dest, const char *signal_prefi
        int ret;
        char signal_name[IC_DBUS_SIGNAL_LENGTH] = {0};
 
-       ret = snprintf(signal_name, sizeof(signal_name), "%s_%"PRIx64, signal_prefix, signal_number);
+       ret = snprintf(signal_name, sizeof(signal_name), "%s_%"PRIx64, signal_prefix,
+                       signal_number);
        if (ret <= 0 || sizeof(signal_name) <= ret) {
                ERR("snprintf() Fail(%d)", ret);
                g_variant_unref(value);
@@ -245,7 +246,7 @@ static int _ioty_oic_action_to_ioty_action(int oic_action)
                break;
        case OC_OBSERVE_NO_OPTION:
        default:
-               ERR("Invalid action (%d)", oic_action);
+               ERR("Invalid action(%d)", oic_action);
                action = IOTCON_OBSERVE_NO_TYPE;
        }
        return action;
@@ -256,11 +257,14 @@ static void _icd_req_context_free(void *ctx)
 {
        struct icd_req_context *req_ctx = ctx;
 
+       RET_IF(NULL == ctx);
+
        free(req_ctx->bus_name);
        if (req_ctx->payload)
                g_variant_unref(req_ctx->payload);
        g_variant_builder_unref(req_ctx->options);
        g_variant_builder_unref(req_ctx->query);
+
        free(req_ctx);
 }
 
@@ -486,8 +490,7 @@ OCStackApplicationResult icd_ioty_ocprocess_find_cb(void *ctx, OCDoHandle handle
        RETV_IF(NULL == ctx, OC_STACK_KEEP_TRANSACTION);
        RETV_IF(NULL == resp, OC_STACK_KEEP_TRANSACTION);
        if (NULL == resp->payload)
-               /* normal case : payload COULD be NULL */
-               return OC_STACK_KEEP_TRANSACTION;
+               return OC_STACK_KEEP_TRANSACTION; /* normal case : payload COULD be NULL */
        RETVM_IF(PAYLOAD_TYPE_DISCOVERY != resp->payload->type,
                        OC_STACK_KEEP_TRANSACTION, "Invalid payload type(%d)", resp->payload->type);
 
index f3dac0fa81421ca77b0360417c8570a5a3d7bb9b..67526db57603452704cc1e26e3f606c8c4ab1625 100644 (file)
@@ -288,7 +288,7 @@ int icd_ioty_notify(OCResourceHandle handle, GVariant *msg, GVariant *observers,
        oc_qos = _icd_ioty_convert_qos(qos);
 
        icd_ioty_csdk_lock();
-       /* TODO : QoS is come from lib. */
+       // TODO: QoS is come from lib.
        if (msg_length)
                ret = OCNotifyListOfObservers(handle, obs_ids, obs_length, payload, oc_qos);
        else
@@ -467,7 +467,7 @@ int icd_ioty_find_resource(const char *host_address,
        icd_ioty_csdk_unlock();
 
        if (OC_STACK_OK != result) {
-               ERR("OCDoResource() Fail(%d)", result);
+               ERR("OCDoResource(DISCOVER) Fail(%d)", result);
                free(context->bus_name);
                free(context);
                return icd_ioty_convert_error(result);
@@ -685,7 +685,7 @@ static gboolean _icd_ioty_crud(int type,
        free(uri);
 
        if (OC_STACK_OK != result) {
-               ERR("OCDoResource() Fail(%d)", result);
+               ERR("OCDoResource(CRUD:%d) Fail(%d)", rest_type, result);
                icd_ioty_complete_error(type, invocation, icd_ioty_convert_error(result));
                return TRUE;
        }
@@ -756,7 +756,7 @@ static OCDoHandle _icd_ioty_observe_register(const char *uri_path,
        icd_ioty_csdk_unlock();
 
        if (OC_STACK_OK != result) {
-               ERR("OCDoResource() Fail(%d)", result);
+               ERR("OCDoResource(OBSERVE:%d) Fail(%d)", method, result);
                if (cbdata->cd)
                        cbdata->cd(cbdata->context);
                return NULL;
@@ -914,7 +914,7 @@ int icd_ioty_get_info(int type, const char *host_address, int conn_type, int tim
        icd_ioty_csdk_unlock();
 
        if (OC_STACK_OK != result) {
-               ERR("OCDoResource() Fail(%d)", result);
+               ERR("OCDoResource(DISCOVER) Fail(%d)", result);
                free(context->bus_name);
                free(context);
                return icd_ioty_convert_error(result);
@@ -1017,7 +1017,7 @@ int icd_ioty_set_platform_info()
        ret = system_info_get_platform_string(ICD_SYSTEM_INFO_TIZEN_ID,
                        &platform_info.platformID);
        if (SYSTEM_INFO_ERROR_NONE != ret) {
-               ERR("system_info_get_platform_string() Fail(%d)", ret);
+               ERR("system_info_get_platform_string(tizenid) Fail(%d)", ret);
                _ioty_free_platform_info(platform_info);
                return IOTCON_ERROR_SYSTEM;
        }
@@ -1026,22 +1026,25 @@ int icd_ioty_set_platform_info()
        ret = system_info_get_platform_string(ICD_SYSTEM_INFO_MANUF_NAME,
                        &platform_info.manufacturerName);
        if (SYSTEM_INFO_ERROR_NONE != ret) {
-               ERR("system_info_get_platform_string() Fail(%d)", ret);
+               ERR("system_info_get_platform_string(manufacturer) Fail(%d)", ret);
                _ioty_free_platform_info(platform_info);
                return IOTCON_ERROR_SYSTEM;
        }
 
        ret = system_info_get_platform_string(ICD_SYSTEM_INFO_MODEL_NAME,
                        &platform_info.modelNumber);
-       WARN_IF(SYSTEM_INFO_ERROR_NONE != ret, "system_info_get_platform_string() Fail(%d)", ret);
+       if (SYSTEM_INFO_ERROR_NONE != ret)
+               WARN("system_info_get_platform_string(model_name) Fail(%d)", ret);
 
        ret = system_info_get_platform_string(ICD_SYSTEM_INFO_PLATFORM_VERSION,
                        &platform_info.platformVersion);
-       WARN_IF(SYSTEM_INFO_ERROR_NONE != ret, "system_info_get_platform_string() Fail(%d)", ret);
+       if (SYSTEM_INFO_ERROR_NONE != ret)
+               WARN("system_info_get_platform_string(platform.version) Fail(%d)", ret);
 
        ret = system_info_get_platform_string(ICD_SYSTEM_INFO_BUILD_STRING,
                        &platform_info.firmwareVersion);
-       WARN_IF(SYSTEM_INFO_ERROR_NONE != ret, "system_info_get_platform_string() Fail(%d)", ret);
+       if (SYSTEM_INFO_ERROR_NONE != ret)
+               WARN("system_info_get_platform_string(build.string) Fail(%d)", ret);
 
        /* platform_info.manufacturerUrl */
        /* platform_info.dateOfManufacture */
@@ -1220,7 +1223,7 @@ OCDoHandle icd_ioty_subscribe_presence(int type, const char *host_address, int c
        icd_ioty_csdk_unlock();
 
        if (OC_STACK_OK != result) {
-               ERR("OCDoResource() Fail(%d)", result);
+               ERR("OCDoResource(PRESENCE) Fail(%d)", result);
                _icd_ioty_presence_table_remove(address);
                return NULL;
        }
@@ -1422,7 +1425,7 @@ gboolean icd_ioty_encap_get(gpointer user_data)
        icd_ioty_csdk_unlock();
 
        if (OC_STACK_OK != result)
-               ERR("OCDoResource() Fail(%d)", result);
+               ERR("OCDoResource(GET) Fail(%d)", result);
 
        return G_SOURCE_CONTINUE;
 }
index 960e8a3ad2b94dfc900a4e0ab8e3ab40e8258f30..ceea5aadb41bb908c362e867fcd3bd747281e5a2 100644 (file)
@@ -328,7 +328,8 @@ GVariant* icd_payload_representation_empty_gvariant(void)
        g_variant_builder_init(&repr, G_VARIANT_TYPE("a{sv}"));
        g_variant_builder_init(&children, G_VARIANT_TYPE("av"));
 
-       value = g_variant_new("(sasasa{sv}av)", IC_STR_NULL, &ifaces, &types, &repr, &children);
+       value = g_variant_new("(sasasa{sv}av)", IC_STR_NULL, &ifaces, &types, &repr,
+                       &children);
 
        return value;
 }
index 086b0a9db7c9431e41dafa2108ae8f3a735b6e47..8232e2876b540d852ba4e5e0b88e1bd8b3ae4849 100644 (file)
@@ -152,7 +152,7 @@ API int iotcon_list_add_byte_str(iotcon_list_h list, unsigned char *val, int len
 
        value = icl_value_create_byte_str(val, len);
        if (NULL == value) {
-               ERR("icl_value_create_str() Fail");
+               ERR("icl_value_create_byte_str() Fail");
                return IOTCON_ERROR_OUT_OF_MEMORY;
        }
 
index e7bb2ef556af168a3101e80a6500af0e42a7c144..cdf5b7fdd771d21b573b57ff6df04d6da4d1fc2f 100644 (file)
@@ -184,7 +184,8 @@ static GVariant* _icl_representation_empty_gvariant(void)
        g_variant_builder_init(&repr, G_VARIANT_TYPE("a{sv}"));
        g_variant_builder_init(&children, G_VARIANT_TYPE("av"));
 
-       value = g_variant_new("(sasasa{sv}av)", IC_STR_NULL, &ifaces, &types, &repr, &children);
+       value = g_variant_new("(sasasa{sv}av)", IC_STR_NULL, &ifaces, &types, &repr,
+                       &children);
 
        return value;
 }
index 8c71dc2371de1d4ab6fc446b96308aa3c1f5a054..00080e4fd00efbc6fa2fbc33cc27d03c382f1997 100644 (file)
@@ -430,7 +430,7 @@ static int _request_handler_delete(iotcon_resource_h resource, iotcon_request_h
 
        ret = iotcon_resource_destroy(resource);
        if (IOTCON_ERROR_NONE != ret) {
-               ERR("iotcon_unregiser_resource() Fail(%d)", ret);
+               ERR("iotcon_resource_destroy() Fail(%d)", ret);
                return -1;
        }
 
@@ -481,7 +481,7 @@ static void _request_handler(iotcon_resource_h resource, iotcon_request_h reques
 
        ret = iotcon_request_get_request_type(request, &type);
        if (IOTCON_ERROR_NONE != ret) {
-               ERR("iotcon_request_get_types() Fail(%d)", ret);
+               ERR("iotcon_request_get_request_type() Fail(%d)", ret);
                _send_response(request, NULL, IOTCON_RESPONSE_ERROR);
                return;
        }
index ad79f4b0ddc39efb3472b38dc92b717953ef0699..898350f9f4aac53d700e432616984b6f39d68c40 100644 (file)
@@ -176,7 +176,7 @@ static iotcon_lite_resource_h _create_door_resource(char *uri_path, char *type,
        ret = iotcon_lite_resource_create(uri_path, resource_types, properties, state,
                        _door_state_changed, NULL, &handle);
        if (IOTCON_ERROR_NONE != ret) {
-               ERR("iotcon_resource_create() Fail");
+               ERR("iotcon_lite_resource_create() Fail");
                iotcon_state_destroy(state);
                iotcon_resource_types_destroy(resource_types);
                return NULL;
index fcf1e689dd5084d1fd794f830e87fe5f5c43fb50..57b0f0bea0bcb22da87cb04ce2201af66c9ab605 100644 (file)
@@ -672,7 +672,7 @@ static void _light_request_handler(iotcon_resource_h resource, iotcon_request_h
 
        ret = iotcon_request_get_request_type(request, &type);
        if (IOTCON_ERROR_NONE != ret) {
-               ERR("iotcon_request_get_types() Fail(%d)", ret);
+               ERR("iotcon_request_get_request_type() Fail(%d)", ret);
                _send_response(request, NULL, iface, IOTCON_RESPONSE_ERROR);
                return;
        }
@@ -698,7 +698,7 @@ static void _fan_request_handler(iotcon_resource_h resource, iotcon_request_h re
 
        ret = iotcon_request_get_request_type(request, &type);
        if (IOTCON_ERROR_NONE != ret) {
-               ERR("iotcon_request_get_types() Fail(%d)", ret);
+               ERR("iotcon_request_get_request_type() Fail(%d)", ret);
                _send_response(request, NULL, iface, IOTCON_RESPONSE_ERROR);
                return;
        }
@@ -734,7 +734,7 @@ static void _room_request_handler(iotcon_resource_h resource, iotcon_request_h r
 
        ret = iotcon_request_get_request_type(request, &type);
        if (IOTCON_ERROR_NONE != ret) {
-               ERR("iotcon_request_get_types() Fail(%d)", ret);
+               ERR("iotcon_request_get_request_type() Fail(%d)", ret);
                _send_response(request, NULL, iface, IOTCON_RESPONSE_ERROR);
                return;
        }