[IoTcon] Fix query creation for requests 28/176228/5
authorRafal Walczyna <r.walczyna@partner.samsung.com>
Tue, 17 Apr 2018 12:39:23 +0000 (14:39 +0200)
committerRafal Walczyna <r.walczyna@partner.samsung.com>
Wed, 18 Apr 2018 06:50:22 +0000 (08:50 +0200)
[Bug] query was not created properly when there was no
resource interface set

[Verification] 100% passrate on TM1

Change-Id: Iea1db9418fe10e9fad56a9bb7de1c34c95cbc5dd
Signed-off-by: Rafal Walczyna <r.walczyna@partner.samsung.com>
src/iotcon/iotcon_utils.cc

index 70546a4..abbe5d8 100644 (file)
@@ -1106,11 +1106,14 @@ common::TizenResult IotconUtils::QueryToJson(iotcon_query_h query, picojson::obj
     {
       // resourceInterface
       char* interface = nullptr;
-      auto result = ConvertIotconError(iotcon_query_get_interface(query, &interface));
-      if (!result || !interface) {
-        LogAndReturnTizenError(result, ("iotcon_query_get_interface() failed"));
+      int err_code = iotcon_query_get_interface(query, &interface);
+      if (IOTCON_ERROR_NONE != err_code) {
+        // if no interface is set to query we continue execution to set other values
+        LoggerW("iotcon_query_get_interface() failed: %d, ignoring resource interface in query",
+                err_code);
+      } else {
+        out->insert(std::make_pair(kResourceInterface, picojson::value{interface}));
       }
-      out->insert(std::make_pair(kResourceInterface, picojson::value{interface}));
     }
 
     {