From ac3e110583314f075bce7120562774f4f75fb996 Mon Sep 17 00:00:00 2001 From: Hasunie Date: Tue, 18 Jul 2017 13:45:03 +0530 Subject: [PATCH] fixing updateEnrollment status issue --- .../carbon/device/mgt/core/dao/impl/EnrollmentDAOImpl.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/EnrollmentDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/EnrollmentDAOImpl.java index 6347d4fe34..33371e3c9d 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/EnrollmentDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/impl/EnrollmentDAOImpl.java @@ -71,7 +71,6 @@ public class EnrollmentDAOImpl implements EnrollmentDAO { Connection conn; PreparedStatement stmt = null; ResultSet rs = null; - int status = -1; try { conn = this.getConnection(); String sql = "UPDATE DM_ENROLMENT SET OWNERSHIP = ?, STATUS = ?, DATE_OF_LAST_UPDATE = ? WHERE DEVICE_ID = ?" + @@ -84,7 +83,7 @@ public class EnrollmentDAOImpl implements EnrollmentDAO { stmt.setString(5, enrolmentInfo.getOwner()); stmt.setInt(6, tenantId); stmt.setInt(7, enrolmentInfo.getId()); - stmt.executeUpdate(); + int status = stmt.executeUpdate(); return status; } catch (SQLException e) { throw new DeviceManagementDAOException("Error occurred while updating enrolment configuration", e); @@ -98,7 +97,6 @@ public class EnrollmentDAOImpl implements EnrollmentDAO { Connection conn; PreparedStatement stmt = null; ResultSet rs = null; - int status = -1; try { conn = this.getConnection(); String sql = "UPDATE DM_ENROLMENT SET OWNERSHIP = ?, STATUS = ?, DATE_OF_LAST_UPDATE = ? WHERE ID = ?"; @@ -107,7 +105,7 @@ public class EnrollmentDAOImpl implements EnrollmentDAO { stmt.setString(2, enrolmentInfo.getStatus().toString()); stmt.setTimestamp(3, new Timestamp(new Date().getTime())); stmt.setInt(4, enrolmentInfo.getId()); - stmt.executeUpdate(); + int status = stmt.executeUpdate(); return status; } catch (SQLException e) { throw new DeviceManagementDAOException("Error occurred while updating enrolment configuration", e);