fix configuration parsing problem in Resource Container
[platform/upstream/iotivity.git] / service / resource-container / src / Configuration.cpp
index 82a58a2..96f9526 100644 (file)
@@ -191,7 +191,7 @@ namespace OIC
             }
         }
 
-        void Configuration::getResourceConfiguration(std::string bundleId, std::string resourceName,
+        void Configuration::getResourceConfiguration(std::string bundleId, std::string resourceUri,
                         resourceInfo *resourceInfoOut){
             rapidxml::xml_node< char > *bundle;
             rapidxml::xml_node< char > *resource;
@@ -200,7 +200,7 @@ namespace OIC
             string strBundleId;
             string strKey, strValue;
             OIC_LOG_V(INFO, CONTAINER_TAG, "Loading resource configuration for %s %s!",
-                    bundleId.c_str(), resourceName.c_str());
+                bundleId.c_str(), resourceUri.c_str());
 
             if (m_loaded)
             {
@@ -209,8 +209,8 @@ namespace OIC
                     // <bundle>
                     if (m_xmlDoc.first_node())
                     {
-                        for (bundle = m_xmlDoc.first_node()->first_node(BUNDLE_TAG); bundle; bundle =
-                                 bundle->next_sibling())
+                        for (bundle = m_xmlDoc.first_node()->first_node(BUNDLE_TAG); bundle;
+                            bundle = bundle->next_sibling())
                         {
                             // <id>
                             strBundleId = bundle->first_node(BUNDLE_ID)->value();
@@ -236,12 +236,18 @@ namespace OIC
 
                                             if (!strKey.compare(OUTPUT_RESOURCE_NAME))
                                             {
-                                                if (trim_both(strValue).compare(resourceName) != 0) break;
+                                                
                                                 resourceInfoOut->name = trim_both(strValue);
                                             }
 
                                             else if (!strKey.compare(OUTPUT_RESOURCE_URI))
+                                            {
+                                                if (trim_both(strValue).compare(resourceUri) != 0)
+                                                {
+                                                    break;
+                                                }
                                                 resourceInfoOut->uri = trim_both(strValue);
+                                            }
 
                                             else if (!strKey.compare(OUTPUT_RESOURCE_ADDR))
                                                 resourceInfoOut->address = trim_both(strValue);