From 3e42cf426f212c3d12838259f93b9ab8fa63ea15 Mon Sep 17 00:00:00 2001 From: geethkokila Date: Fri, 7 Jul 2017 17:59:28 +0530 Subject: [PATCH] Fixing the null pointer --- .../type/template/dao/DeviceTypePluginDAOImpl.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/dao/DeviceTypePluginDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/dao/DeviceTypePluginDAOImpl.java index 37331ec080..a8f9141904 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/dao/DeviceTypePluginDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/main/java/org/wso2/carbon/device/mgt/extensions/device/type/template/dao/DeviceTypePluginDAOImpl.java @@ -36,7 +36,7 @@ import java.util.List; * Implements CRUD for Devices. This holds the generic implementation. An instance of this will be created for * each device type. */ -public class DeviceTypePluginDAOImpl implements PluginDAO{ +public class DeviceTypePluginDAOImpl implements PluginDAO { private static final Log log = LogFactory.getLog(DeviceTypePluginDAOImpl.class); private DeviceTypeDAOHandler deviceTypeDAOHandler; @@ -241,9 +241,11 @@ public class DeviceTypePluginDAOImpl implements PluginDAO{ } private String getPropertString(List properties, String propertyName) { - for (Device.Property property : properties) { - if (property.getName() != null && property.getName().equals(propertyName)) { - return property.getValue(); + if (properties != null) { + for (Device.Property property : properties) { + if (property.getName() != null && property.getName().equals(propertyName)) { + return property.getValue(); + } } } return null;