From 17638029d3ee084a22a02a29b091931e9632bc0a Mon Sep 17 00:00:00 2001 From: Vigneshan Date: Thu, 24 Nov 2022 10:34:58 +0000 Subject: [PATCH] Fix group update issue --- .../mgt/core/service/GroupManagementProviderServiceImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/GroupManagementProviderServiceImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/GroupManagementProviderServiceImpl.java index cd560eef40..c036e752af 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/GroupManagementProviderServiceImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/service/GroupManagementProviderServiceImpl.java @@ -194,8 +194,8 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid GroupManagementDAOFactory.beginTransaction(); DeviceGroup existingGroup = this.groupDAO.getGroup(groupId, tenantId); if (existingGroup != null) { - boolean existingGroupName = this.groupDAO.getGroup(deviceGroup.getName(), tenantId) != null; - if (existingGroupName) { + DeviceGroup existingGroupByName = this.groupDAO.getGroup(deviceGroup.getName(), tenantId); + if (existingGroupByName != null && existingGroupByName.getGroupId() != groupId) { throw new GroupAlreadyExistException("Group already exists with name '" + deviceGroup.getName() + "'."); } List groupsToUpdate = new ArrayList<>();