From f32e76346f111059dda189e469c6f0c58bc0ba3d Mon Sep 17 00:00:00 2001 From: "tcdlpds@gmail.com" Date: Thu, 1 Oct 2020 12:38:22 +0530 Subject: [PATCH] Improve mail sending logic --- .../core/service/DeviceManagementProviderServiceImpl.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java index 6481e7a4998..cbc76bc7ac1 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/DeviceManagementProviderServiceImpl.java @@ -4220,6 +4220,11 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv log.debug("Triggering Corrective action. Device Identifier: " + deviceIdentifier); } + if (StringUtils.isBlank(featureCode)){ + String msg = "Found a Blan feature code: " + featureCode; + log.error(msg); + throw new BadRequestException(msg); + } if (configList == null || configList.isEmpty()) { String msg = "Platform config is not configured"; log.error(msg); @@ -4236,7 +4241,7 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv for (String action : actions) { for (ConfigurationEntry config : configList) { - if (config.getName().equals(featureCode)) { + if (featureCode.equals(config.getName())) { CorrectiveActionConfig correctiveActionConfig = (CorrectiveActionConfig) config.getValue(); if (correctiveActionConfig.getActionTypes().contains(action)) { if (DeviceManagementConstants.CorrectiveActions.E_MAIL.equals(action)) {