Fix for the Jira issue IOT-538
authorJay Sharma <jay.sharma@samsung.com>
Fri, 5 Jun 2015 13:08:29 +0000 (18:38 +0530)
committerUze Choi <uzchoi@samsung.com>
Thu, 11 Jun 2015 12:12:39 +0000 (12:12 +0000)
CpluffAdapter::findPlugins and PluginManagerImpl::findPlugins methods include the
plugins which does not have the attribute of parameter "key" and when the parameter
"value" is empty string. Modified the code to handle the case where getValueByAttribute
method returns empty string value.

Change-Id: Ia2564bff28b273a3552686d16374198e223f0bb2
Signed-off-by: Jay Sharma <jay.sharma@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/1206
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Uze Choi <uzchoi@samsung.com>
service/protocol-plugin/plugin-manager/src/CpluffAdapter.cpp
service/protocol-plugin/plugin-manager/src/PluginManagerImpl.cpp

index 8db6d6e0e62febbd7cd6e7c440313b8e90b98df6..b4b641f2a7b8759c1aaeef75643f33d315f8a173 100644 (file)
@@ -313,7 +313,8 @@ std::vector<Plugin> *CpluffAdapter::findPlugins(const std::string key, const std
 
     for (unsigned int i = 0; i < m_plugins.size(); i++)
     {
-        if (!m_plugins[i].getValueByAttribute(key).compare(value))
+        std::string attributeValue = m_plugins[i].getValueByAttribute(key);
+        if (!attributeValue.empty() && !attributeValue.compare(value))
         {
             re_plugins->push_back(m_plugins[i]);
         }
index 19bfc4211244acdecbccbd718f5225228fe0ca76..785fe71c0d560763a1932ac7bab7645f7712ba7c 100644 (file)
@@ -161,7 +161,8 @@ std::vector<Plugin> *PluginManagerImpl::findPlugins(const std::string key,
     re_plugins = new std::vector<Plugin>;
     for (unsigned int i = 0; i < m_plugins.size(); i++)
     {
-        if (!m_plugins[i].getValueByAttribute(key).compare(value))
+        std::string attributeValue = m_plugins[i].getValueByAttribute(key);
+        if (!attributeValue.empty() && !attributeValue.compare(value))
         {
             re_plugins->push_back(m_plugins[i]);
         }