From 625ad6d1dcd452bff7e8b31b1308903177fb67bf Mon Sep 17 00:00:00 2001 From: DilanUA Date: Mon, 20 Apr 2015 20:58:19 +0530 Subject: [PATCH 1/2] Fixed some possible NPE issues in DeviceManagementServiceProviderImpl.java --- .../mgt/core/DeviceManagementServiceProviderImpl.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagementServiceProviderImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagementServiceProviderImpl.java index a63770e7382..4618a1703ca 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagementServiceProviderImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagementServiceProviderImpl.java @@ -243,8 +243,8 @@ public class DeviceManagementServiceProviderImpl implements DeviceManagementServ String subject = ""; for(NotificationMessages notificationMessage : notificationMessages){ - if (notificationMessage.getType().equals(DeviceManagementConstants.EmailNotifications - .ENROL_NOTIFICATION_TYPE)){ + if (DeviceManagementConstants.EmailNotifications.ENROL_NOTIFICATION_TYPE. + equals(notificationMessage.getType())) { messageHeader = notificationMessage.getHeader(); messageBody = notificationMessage.getBody(); messageFooter = notificationMessage.getFooter(); @@ -298,8 +298,8 @@ public class DeviceManagementServiceProviderImpl implements DeviceManagementServ String subject = ""; for(NotificationMessages notificationMessage : notificationMessages){ - if (notificationMessage.getType().equals(DeviceManagementConstants.EmailNotifications - .USER_REGISTRATION_NOTIFICATION_TYPE)){ + if (DeviceManagementConstants.EmailNotifications.USER_REGISTRATION_NOTIFICATION_TYPE. + equals(notificationMessage.getType())) { messageHeader = notificationMessage.getHeader(); messageBody = notificationMessage.getBody(); messageFooter = notificationMessage.getFooter(); From f558357c2a292c126de576659c06b514ef1b2120 Mon Sep 17 00:00:00 2001 From: Dulitha Wijewantha Date: Tue, 21 Apr 2015 13:33:32 +0530 Subject: [PATCH 2/2] Fixed syntax issues due to spacing --- .../operation/mgt/dao/impl/OperationDAOImpl.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/OperationDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/OperationDAOImpl.java index d9ae0639fbd..73b3d8d4e98 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/OperationDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/OperationDAOImpl.java @@ -119,11 +119,11 @@ public class OperationDAOImpl implements OperationDAO { try { Connection conn = OperationManagementDAOFactory.getConnection(); String sql = "SELECT o.ID, o.TYPE, o.CREATED_TIMESTAMP, o.RECEIVED_TIMESTAMP, o.STATUS, o.OPERATION_CODE," + - "po.OPERATION_DETAILS,co.ENABLED from " + - "(SELECT ID, TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, STATUS, OPERATION_CODE FROM " + - " DM_OPERATION WHERE id=?) o" + - "LEFT OUTER JOIN DM_PROFILE_OPERATION po on o.ID =po.OPERATION_ID" + - "LEFT OUTER JOIN DM_COMMAND_OPERATION co on co.OPERATION_ID=o.ID"; + " po.OPERATION_DETAILS, co.ENABLED from" + + " (SELECT ID, TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, STATUS, OPERATION_CODE FROM " + + " DM_OPERATION WHERE id=?) o" + + " LEFT OUTER JOIN DM_PROFILE_OPERATION po on o.ID=po.OPERATION_ID" + + " LEFT OUTER JOIN DM_COMMAND_OPERATION co on co.OPERATION_ID=o.ID"; stmt = conn.prepareStatement(sql); stmt.setInt(1, id); @@ -184,7 +184,7 @@ public class OperationDAOImpl implements OperationDAO { try { Connection conn = OperationManagementDAOFactory.getConnection(); String sql = "SELECT o.ID, o.TYPE, o.CREATED_TIMESTAMP, o.RECEIVED_TIMESTAMP, o.STATUS, o.OPERATION_CODE," + - "po.OPERATION_DETAILS,co.ENABLED from " + + " po.OPERATION_DETAILS,co.ENABLED from " + "(SELECT ID, TYPE, CREATED_TIMESTAMP, RECEIVED_TIMESTAMP, STATUS, " + "OPERATION_CODE FROM DM_OPERATION WHERE id=?) o INNER JOIN (Select * from " + "DM_DEVICE_OPERATION_MAPPING dm where dm.OPERATION_ID=? AND dm.DEVICE_ID=?) om " +