From 56ae5f078f9b10ac9c2eb53342b8e11c1efda0a8 Mon Sep 17 00:00:00 2001 From: Jay Sharma Date: Fri, 5 Jun 2015 18:38:29 +0530 Subject: [PATCH] Fix for the Jira issue IOT-538 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 Reviewed-on: https://gerrit.iotivity.org/gerrit/1206 Tested-by: jenkins-iotivity Reviewed-by: Uze Choi --- service/protocol-plugin/plugin-manager/src/CpluffAdapter.cpp | 3 ++- service/protocol-plugin/plugin-manager/src/PluginManagerImpl.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/service/protocol-plugin/plugin-manager/src/CpluffAdapter.cpp b/service/protocol-plugin/plugin-manager/src/CpluffAdapter.cpp index 8db6d6e..b4b641f 100644 --- a/service/protocol-plugin/plugin-manager/src/CpluffAdapter.cpp +++ b/service/protocol-plugin/plugin-manager/src/CpluffAdapter.cpp @@ -313,7 +313,8 @@ std::vector *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]); } diff --git a/service/protocol-plugin/plugin-manager/src/PluginManagerImpl.cpp b/service/protocol-plugin/plugin-manager/src/PluginManagerImpl.cpp index 19bfc42..785fe71 100644 --- a/service/protocol-plugin/plugin-manager/src/PluginManagerImpl.cpp +++ b/service/protocol-plugin/plugin-manager/src/PluginManagerImpl.cpp @@ -161,7 +161,8 @@ std::vector *PluginManagerImpl::findPlugins(const std::string key, re_plugins = new std::vector; 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]); } -- 2.7.4