From 1c3a89f57c381594ccdf554bb888f0db6e1d588b Mon Sep 17 00:00:00 2001 From: ayyoob Date: Wed, 10 May 2017 13:49:20 +0530 Subject: [PATCH] fixed issues raised through comments - commits --- .../template/DeviceTypeManagerService.java | 13 ++++++++----- .../DeviceManagementProviderServiceImpl.java | 14 +++++--------- 2 files changed, 13 insertions(+), 14 deletions(-) diff --git a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/deployer/template/DeviceTypeManagerService.java b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/deployer/template/DeviceTypeManagerService.java index 0ee091ce2a9..6db5d88054d 100644 --- a/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/deployer/template/DeviceTypeManagerService.java +++ b/components/device-mgt-extensions/org.wso2.carbon.device.mgt.extensions.device.type.deployer/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/deployer/template/DeviceTypeManagerService.java @@ -32,6 +32,7 @@ import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration import org.wso2.carbon.device.mgt.common.policy.mgt.PolicyMonitoringManager; import org.wso2.carbon.device.mgt.common.push.notification.PushNotificationConfig; import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService; +import org.wso2.carbon.device.mgt.extensions.device.type.deployer.config.ConfigProperties; import org.wso2.carbon.device.mgt.extensions.device.type.deployer.config.DeviceTypeConfiguration; import org.wso2.carbon.device.mgt.extensions.device.type.deployer.config.Property; import org.wso2.carbon.device.mgt.extensions.device.type.deployer.config.PushNotificationProvider; @@ -113,11 +114,13 @@ public class DeviceTypeManagerService implements DeviceManagementService { if (pushNotificationProvider != null) { if (pushNotificationProvider.isFileBasedProperties()) { Map staticProps = new HashMap<>(); - if (pushNotificationProvider.getConfigProperties() != null && - pushNotificationProvider.getConfigProperties().getProperty() != null && - pushNotificationProvider.getConfigProperties().getProperty().size() > 0) { - for (Property property : pushNotificationProvider.getConfigProperties().getProperty()) { - staticProps.put(property.getName(), property.getValue()); + ConfigProperties configProperties = pushNotificationProvider.getConfigProperties(); + if (configProperties != null) { + List properties = configProperties.getProperty(); + if (properties != null && properties.size() > 0) { + for (Property property : properties) { + staticProps.put(property.getName(), property.getValue()); + } } } pushNotificationConfig = new PushNotificationConfig(pushNotificationProvider.getType(), 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 083b795a9db..13a55476871 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 @@ -2121,17 +2121,13 @@ public class DeviceManagementProviderServiceImpl implements DeviceManagementProv operation.setType(Operation.Type.COMMAND); operation.setCode(str); try { - deviceManagementProviderService. - addOperation(deviceType, - operation, deviceIdentifiers); + deviceManagementProviderService.addOperation(deviceType, operation, deviceIdentifiers); } catch (OperationManagementException e) { - throw new DeviceManagementException( - "Unable to find the device with the id: '" + deviceIdentifier.getId(), - e); + throw new DeviceManagementException("Unable to add the operation for the device with the id: '" + + deviceIdentifier.getId(), e); } catch (InvalidDeviceException e) { - throw new DeviceManagementException( - "Unable to find the device with the id: '" + deviceIdentifier.getId(), - e); + throw new DeviceManagementException("Unable to find the device with the id: '" + + deviceIdentifier.getId(), e); } } }