From: Hyunjin Park Date: Wed, 7 Dec 2016 11:57:03 +0000 (+0900) Subject: [package] fix issue of web TCT X-Git-Tag: submit/tizen_3.0/20161208.070442~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=053690e116cbbac4ef98402980c98ff05adbe5a9;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git [package] fix issue of web TCT - cause : native API is changed not to throw invalid parameter in no db case. - solution : add code to check package db [verification] test result of Web TCT is 100% pass rate. Change-Id: If2b1c1aa9a83f5df8dee725e2015963d24da4c48 --- diff --git a/src/package/package_instance.cc b/src/package/package_instance.cc index 81250763..3a24edb1 100644 --- a/src/package/package_instance.cc +++ b/src/package/package_instance.cc @@ -366,22 +366,31 @@ void PackageInstance::PackageManagerUninstall( return; } - int request_id = 0; - int ret = package_manager_request_uninstall(request_, id.c_str(), &request_id); + package_info_h pkg_info; + int ret = package_manager_get_package_info(id.c_str(), &pkg_info); if ( ret != PACKAGE_MANAGER_ERROR_NONE ) { - if ( ret == PACKAGE_MANAGER_ERROR_INVALID_PARAMETER ) { - LoggerE("The package is not found at the specified location"); - InvokeErrorCallbackAsync(callback_id, - NotFoundException( - "The package is not found at the specified location")); + if ( ret == PACKAGE_MANAGER_ERROR_NO_SUCH_PACKAGE ) { + LoggerE("The package is not found at the specified location"); + InvokeErrorCallbackAsync(callback_id, + NotFoundException( + "The package is not found at the specified location")); } else { - LoggerE("Failed to uninstall package: %d (%s)", ret, get_error_message(ret)); - InvokeErrorCallbackAsync(callback_id, UnknownException( - "It is not allowed to install the package by the platform or " \ - "any other platform error occurs")); + LoggerE("Failed to get package info: %d (%s)", ret, get_error_message(ret)); + InvokeErrorCallbackAsync(callback_id, UnknownException( + "It is not allowed to get package information by the platform or " \ + "any other platform error occurs")); } } else { - RegisterCallback(request_id, callback_id); + int request_id = 0; + int ret = package_manager_request_uninstall(request_, id.c_str(), &request_id); + if ( ret != PACKAGE_MANAGER_ERROR_NONE ) { + LoggerE("Failed to uninstall package: %d (%s)", ret, get_error_message(ret)); + InvokeErrorCallbackAsync(callback_id, UnknownException( + "It is not allowed to install the package by the platform or " \ + "any other platform error occurs")); + } else { + RegisterCallback(request_id, callback_id); + } } ReportSuccess(out);