From 20873e77868cd90ea3f29a384b37bf9b9782e90a Mon Sep 17 00:00:00 2001 From: harshanl Date: Mon, 31 Aug 2015 14:37:44 +0530 Subject: [PATCH] Added null checks --- .../mgt/core/config/permission/PermissionManager.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/permission/PermissionManager.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/permission/PermissionManager.java index 2681ebc8e0..0e370b3825 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/permission/PermissionManager.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/config/permission/PermissionManager.java @@ -66,8 +66,11 @@ public class PermissionManager { /* Un-marshaling Device Management configuration */ JAXBContext cdmContext = JAXBContext.newInstance(PermissionConfiguration.class); Unmarshaller unmarshaller = cdmContext.createUnmarshaller(); - PermissionConfiguration permissionConfiguration = (PermissionConfiguration) unmarshaller.unmarshal(permissionStream); - this.addPermissions(permissionConfiguration.getPermissions()); + PermissionConfiguration permissionConfiguration = (PermissionConfiguration) + unmarshaller.unmarshal(permissionStream); + if((permissionConfiguration != null) && (permissionConfiguration.getPermissions() != null)){ + this.addPermissions(permissionConfiguration.getPermissions()); + } } } catch (JAXBException e) { throw new DeviceManagementException("Error occurred while initializing Data Source config", e);