Fix static analysis issues
authorChanggyu Choi <changyu.choi@samsung.com>
Thu, 10 Apr 2025 09:54:56 +0000 (18:54 +0900)
committerChanggyu Choi <changyu.choi@samsung.com>
Thu, 10 Apr 2025 09:55:14 +0000 (18:55 +0900)
Signed-off-by: Changgyu Choi <changyu.choi@samsung.com>
src/common/action_executor.hh
src/common/action_model.h
src/common/action_parameter.cc
src/plugin-daemon/main.cc
src/service/main.cc

index 4a92f2ece13b6432a5790292dfdaf47a90e0f965..a3b7e2645992bb517cbd5c30667ddde22810b6cb 100644 (file)
@@ -38,7 +38,7 @@ class AbstractActionExecutor {
 
  private:
   std::string id_;
-  IActionResultHandler* handler_;
+  IActionResultHandler* handler_ = nullptr;
 };
 
 }  // namespace common
index 0f8c01cfcc1f59604ea41dd6077ad20bd8f410e0..cbc3b81b19f27f931ef968ff48abe20e6c2e0760 100644 (file)
@@ -60,7 +60,7 @@ class ActionModel {
  private:
   std::string action_id_;
   std::string app_id_;
-  ActionType type_;
+  ActionType type_ = ActionType::InvalidType;
   std::string description_;
 
   //is std::map better?
index 46b289a3296b18672be8b33e18535aad95b4caf7..eb76eb1defd6e74094d18f1490411d640166a92e 100644 (file)
@@ -18,7 +18,7 @@
 
 namespace common {
 
-ActionParameter::ActionParameter() {}
+ActionParameter::ActionParameter() : type_(ParameterType::InvalidType), is_required_(false) {}
 
 ActionParameter::ActionParameter(std::string name, ParameterType type, std::string value, std::string description, bool is_required)
   : name_(std::move(name)), type_(type), value_(std::move(value)), description_(std::move(description)), is_required_(is_required) {
index 19f914c664c8b9ea32c5ef52d9e5af2fa669bdfd..7904548fd81ab4f098f35d16f763754d82123550 100644 (file)
@@ -102,12 +102,18 @@ int main() {
   int ret = rpc_port_register_proc_info(
       "d::org.tizen.appfw.service.tizen_action_plugin_manager", nullptr);
   if (ret != 0) {
-    perror("Failed to register proc info");
+    LOG(ERROR) << "Failed to register proc info";
     return -1;
   }
 
-  rpc_port::plugin_manager_stub::stub::PluginManager stub;
-  stub.Listen(std::make_shared<PluginService::Factory>());
+  try {
+    rpc_port::plugin_manager_stub::stub::PluginManager stub;
+    stub.Listen(std::make_shared<PluginService::Factory>());
+  } catch (rpc_port::plugin_manager_stub::stub::InvalidIOException& e) {
+    LOG(ERROR) << "InvalidIOException";
+    return 0;
+  }
+
   auto* mainloop = g_main_loop_new(nullptr, FALSE);
   g_main_loop_run(mainloop);
   g_main_loop_unref(mainloop);
index e3dd3a4f5791d8a0e1a059af81c77f98d0e24db5..21a2c1149a0c36c6330616f9cf6e3f4787d576ef 100644 (file)
@@ -72,8 +72,13 @@ int main(int argc, char* argv[]) {
        service_app_add_event_handler(&handlers[APP_EVENT_REGION_FORMAT_CHANGED],
       APP_EVENT_REGION_FORMAT_CHANGED, ServiceAppRegionChanged, nullptr);
 
-  action::ActionRequestHandler manager;
-  manager.Init();
+  try {
+    action::ActionRequestHandler manager;
+    manager.Init();
+  } catch (...) {
+    LOG(ERROR) << "Failed to initialize ActionRequestHandler";
+    return -1;
+  }
 
   LOG(DEBUG) << "service_app_main start...";