Fix crash when manifest is not provided.
Change-Id: I1f1c50856f3553c2a2f6d218a8af2ec2dbfd5b95
Signed-off-by: Sangyoon Jang <jeremy.jang@samsung.com>
bool PluginManager::IsDataRemoved(const char* data_type,
const std::string& data) {
- return pkg_query_.IsPluginExecuted(std::string(data_type), data);
+ PkgQueryInterface pkg_query(pkgid_, uid_);
+ return pkg_query.IsPluginExecuted(data_type, data);
}
bool PluginManager::GenerateUnknownTagList(
PluginManager(const boost::filesystem::path& xml_path,
const boost::filesystem::path& list_path,
+ const std::string& pkgid,
manifest_x* manifest,
uid_t uid)
: xml_parser_(xml_path),
list_parser_(list_path),
+ pkgid_(pkgid),
manifest_(manifest),
- uid_(uid),
- pkg_query_(std::string(manifest_->package), uid_) {}
+ uid_(uid) {}
bool LoadPlugins(Plugin::ActionType action_type);
bool RunPlugins(Plugin::ActionType action_type);
PluginsXmlParser xml_parser_;
PluginsListParser list_parser_;
+ std::string pkgid_;
manifest_x* manifest_;
uid_t uid_;
- PkgQueryInterface pkg_query_;
std::vector<std::unique_ptr<Plugin>> loaded_plugins_;
};
bool PluginsXmlParser::Parse() {
if (path_.empty()) {
+ LOG(ERROR) << "Xml path is empty";
return false;
}
// PLUGINS_LIST_INSTALL_PATH path generated from cmake
const std::string listPath(PLUGINS_LIST_INSTALL_PATH);
plugin_manager_.reset(
- new PluginManager(xml_path.string(), listPath, manifest, uid));
+ new PluginManager(xml_path.string(), listPath, context_->pkgid.get(),
+ manifest, uid));
if (!plugin_manager_.get()) {
LOG(ERROR) << "plugin_manager_ reset fail, plugin_manager_ is NULL";
return false;
configuration::StepParseManifest::ManifestLocation::PACKAGE, \
configuration::StepParseManifest::StoreLocation::NORMAL); \
ASSERT_EQ(step.process(), Step::Status::OK); \
- PluginManager manager(manifest, list, \
+ PluginManager manager(manifest, list, context.pkgid.get(), \
context.manifest_data.get(), getuid()); \
ASSERT_TRUE(manager.LoadPlugins(ACTION)); \
manager.RunPlugins(ACTION); \
configuration::StepParseManifest::ManifestLocation::PACKAGE, \
configuration::StepParseManifest::StoreLocation::NORMAL); \
ASSERT_EQ(step.process(), Step::Status::OK); \
- PluginManager manager(manifest, list, \
+ PluginManager manager(manifest, list, context.pkgid.get(), \
context.manifest_data.get(), getuid()); \
ASSERT_TRUE(manager.LoadPlugins(ACTION)); \
ASSERT_FALSE(manager.RunPlugins(ACTION)); \