summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomasz Iwanek <t.iwanek@samsung.com>2015-03-18 16:10:39 +0100
committerPawel Sikorski <p.sikorski@samsung.com>2015-03-19 08:12:06 -0700
commit959fe7a29ed106aec1a9000810b6212be461ab3d (patch)
tree38ee1d27738710ebe6372631c30beb223679e6d4
parentb907d4bebcc7b32e7ce4bfb7aa24a5bcba8d5f39 (diff)
downloadapp-installers-accepted/tizen_3.0.2015.q1_common.tar.gz
app-installers-accepted/tizen_3.0.2015.q1_common.tar.bz2
app-installers-accepted/tizen_3.0.2015.q1_common.zip
In current execution flow, there is call of Parse() function for each handler. Handler should be prepared for situation that there is no value it expects. Change-Id: Ib17ed3e4bbb5600397c9bf23cf140d0d064b8d29
-rw-r--r--src/widget-manifest-parser/manifest_handlers/app_control_handler.cc8
-rw-r--r--src/widget-manifest-parser/manifest_handlers/category_handler.cc8
-rw-r--r--src/widget-manifest-parser/manifest_handlers/ime_handler.cc8
-rw-r--r--src/widget-manifest-parser/manifest_handlers/metadata_handler.cc1
4 files changed, 19 insertions, 6 deletions
diff --git a/src/widget-manifest-parser/manifest_handlers/app_control_handler.cc b/src/widget-manifest-parser/manifest_handlers/app_control_handler.cc
index 13e696a5..00b42374 100644
--- a/src/widget-manifest-parser/manifest_handlers/app_control_handler.cc
+++ b/src/widget-manifest-parser/manifest_handlers/app_control_handler.cc
@@ -68,8 +68,9 @@ bool AppControlHandler::Parse(std::shared_ptr<ApplicationData> application,
std::string* error) {
const Manifest* manifest = application->GetManifest();
std::shared_ptr<AppControlInfoList> aplist(new AppControlInfoList());
- utils::Value* value;
- manifest->Get(keys::kTizenApplicationAppControlsKey, &value);
+ utils::Value* value = nullptr;
+ if (!manifest->Get(keys::kTizenApplicationAppControlsKey, &value))
+ return true;
if (value->GetType() == utils::Value::TYPE_LIST) {
// multiple entries
@@ -107,6 +108,9 @@ bool AppControlHandler::Validate(
static_cast<const AppControlInfoList*>(
application->GetManifestData(keys::kTizenApplicationAppControlsKey));
+ if (!app_controls)
+ return true;
+
for (const auto& item : app_controls->controls) {
if (item.src().empty()) {
*error = "The src child element of app-control element is obligatory";
diff --git a/src/widget-manifest-parser/manifest_handlers/category_handler.cc b/src/widget-manifest-parser/manifest_handlers/category_handler.cc
index 4be306e5..80dd8a5d 100644
--- a/src/widget-manifest-parser/manifest_handlers/category_handler.cc
+++ b/src/widget-manifest-parser/manifest_handlers/category_handler.cc
@@ -42,8 +42,9 @@ bool CategoryHandler::Parse(std::shared_ptr<ApplicationData> application,
std::string* error) {
const Manifest* manifest = application->GetManifest();
std::shared_ptr<CategoryInfoList> aplist(new CategoryInfoList());
- utils::Value* value;
- manifest->Get(keys::kTizenCategoryKey, &value);
+ utils::Value* value = nullptr;
+ if (!manifest->Get(keys::kTizenCategoryKey, &value))
+ return true;
if (value->GetType() == utils::Value::TYPE_LIST) {
// multiple entries
@@ -79,6 +80,9 @@ bool CategoryHandler::Validate(
static_cast<const CategoryInfoList*>(
application->GetManifestData(keys::kTizenCategoryKey));
+ if (!categories_list)
+ return true;
+
for (const auto& item : categories_list->categories) {
if (item.empty()) {
*error = kErrMsgCategoryName;
diff --git a/src/widget-manifest-parser/manifest_handlers/ime_handler.cc b/src/widget-manifest-parser/manifest_handlers/ime_handler.cc
index 7810fc7b..ba159796 100644
--- a/src/widget-manifest-parser/manifest_handlers/ime_handler.cc
+++ b/src/widget-manifest-parser/manifest_handlers/ime_handler.cc
@@ -125,8 +125,9 @@ bool ImeHandler::Parse(std::shared_ptr<ApplicationData> application,
const Manifest* manifest = application->GetManifest();
assert(manifest);
- utils::Value* value;
- manifest->Get(keys::kTizenImeKey, &value);
+ utils::Value* value = nullptr;
+ if (!manifest->Get(keys::kTizenImeKey, &value) )
+ return true;
bool result = true;
@@ -155,6 +156,9 @@ bool ImeHandler::Validate(
static_cast<const ImeInfo*>(
application->GetManifestData(keys::kTizenImeKey));
+ if (!ime_info)
+ return true;
+
if (ime_info->uuid().empty()) {
*error = kErrMsgValidatingUuidEmpty;
return false;
diff --git a/src/widget-manifest-parser/manifest_handlers/metadata_handler.cc b/src/widget-manifest-parser/manifest_handlers/metadata_handler.cc
index 8106d5f3..89f5a589 100644
--- a/src/widget-manifest-parser/manifest_handlers/metadata_handler.cc
+++ b/src/widget-manifest-parser/manifest_handlers/metadata_handler.cc
@@ -71,6 +71,7 @@ bool MetaDataHandler::Parse(std::shared_ptr<ApplicationData> application,
utils::Value* metadata_value = NULL;
if (!manifest->Get(keys::kTizenMetaDataKey, &metadata_value)) {
LOG(INFO) << "Failed to get value of tizen metaData";
+ return true;
}
MetaDataPair metadata_item;