download_get_url() return wrong error with invalid id
authorBang Kwang-Min <justine.bang@samsung.com>
Thu, 9 May 2013 04:44:55 +0000 (13:44 +0900)
committerBang Kwang-Min <justine.bang@samsung.com>
Thu, 9 May 2013 06:40:57 +0000 (15:40 +0900)
[issue#] failure in Tizen Compliance Tests
[cause] if sql return empty string, client will meet socket timeout error
[solution] add the checking the length of string

Change-Id: I16e840326e4ba7ac7e6cd5451b5ae77b9a55e348

provider/download-provider-thread-request.c

index 195395b..e8262b2 100755 (executable)
@@ -974,7 +974,7 @@ void *dp_thread_requests_manager(void *arg)
                                if (request == NULL) {
                                        int check_id = dp_db_get_int_column(command.id,
                                                        DP_DB_TABLE_LOG, DP_DB_COL_ID);
-                                       if (check_id != command.id) {
+                                       if (check_id < 0 || check_id != command.id) {
                                                errorcode = DP_ERROR_ID_NOT_FOUND;
                                                TRACE_ERROR("[ERROR][%d][%s]", command.id,
                                                        dp_print_errorcode(errorcode));
@@ -1155,6 +1155,8 @@ void *dp_thread_requests_manager(void *arg)
                                        break;
                                }
                                if (is_checked == 1) {
+                                       if (read_str == NULL || strlen(read_str) < 1)
+                                               errorcode = DP_ERROR_NO_DATA;
                                        dp_ipc_send_errorcode(sock, errorcode);
                                        if (errorcode == DP_ERROR_NONE) {
                                                dp_ipc_send_string(sock, read_str);