From: Changgyu Choi Date: Tue, 25 Aug 2020 00:22:16 +0000 (+0900) Subject: Add exception handling X-Git-Tag: accepted/tizen/unified/20200827.105739~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a2bd18bddc0489a1b99473dab1a62e85a3137025;p=platform%2Fcore%2Fappfw%2Faul-1.git Add exception handling Change-Id: I4f8e53fe51f698708a0ddc59e814c1ff7801d587 Signed-off-by: Changgyu Choi --- diff --git a/parser/metadata/alias-appid/plugin_manager.cc b/parser/metadata/alias-appid/plugin_manager.cc index 44e13df..c057d5a 100644 --- a/parser/metadata/alias-appid/plugin_manager.cc +++ b/parser/metadata/alias-appid/plugin_manager.cc @@ -35,11 +35,11 @@ PluginManager& PluginManager::GetInst() { bool PluginManager::StepInstall(const std::unique_ptr& args) { auto* db = dynamic_cast(GetDB()); - if (db == nullptr) { _E("MetadataPlugin is not prepared"); return false; } + for (auto& metadata : args->GetMetadataList()) { try { db->Insert(metadata->GetValue(), args->GetAppId()); @@ -52,11 +52,11 @@ bool PluginManager::StepInstall(const std::unique_ptr& args) { bool PluginManager::StepUninstall(const std::unique_ptr& args) { auto* db = dynamic_cast(GetDB()); - if (db == nullptr) { _E("MetadataPlugin is not prepared"); return false; } + if (args->GetMetadataList().empty()) { try { db->Delete(args->GetAppId()); @@ -78,11 +78,11 @@ bool PluginManager::StepUninstall(const std::unique_ptr& args) { bool PluginManager::StepUpgrade(const std::unique_ptr& args) { auto* db = dynamic_cast(GetDB()); - if (db == nullptr) { _E("MetadataPlugin is not prepared"); return false; } + try { db->Delete(args->GetAppId()); } catch (Exception& e) { diff --git a/parser/metadata/allowed-appid/plugin_manager.cc b/parser/metadata/allowed-appid/plugin_manager.cc index 6f50a7e..d6de6c8 100644 --- a/parser/metadata/allowed-appid/plugin_manager.cc +++ b/parser/metadata/allowed-appid/plugin_manager.cc @@ -35,6 +35,11 @@ PluginManager& PluginManager::GetInst() { bool PluginManager::StepInstall(const std::unique_ptr& args) { auto* db = dynamic_cast(GetDB()); + if (db == nullptr) { + _E("MetadataPlugin is not prepared"); + return false; + } + for (auto& metadata : args->GetMetadataList()) { try { db->Insert(args->GetAppId(), metadata->GetValue()); @@ -46,8 +51,13 @@ bool PluginManager::StepInstall(const std::unique_ptr& args) { } bool PluginManager::StepUninstall(const std::unique_ptr& args) { + auto* db = dynamic_cast(GetDB()); + if (db == nullptr) { + _E("MetadataPlugin is not prepared"); + return false; + } + try { - auto* db = dynamic_cast(GetDB()); db->Delete(args->GetAppId()); } catch (Exception& e) { _W("Failed to delete alias info. appid(%s)", args->GetAppId().c_str());