diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/GroupManagementService.java b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/GroupManagementService.java index 4880231574..f61d212493 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/GroupManagementService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.api/src/main/java/org/wso2/carbon/device/mgt/jaxrs/service/api/GroupManagementService.java @@ -450,7 +450,7 @@ public interface GroupManagementService { "the requested resource."), @ApiResponse( code = 404, - message = "Group found.", + message = "Group not found.", response = ErrorResponse.class), @ApiResponse( code = 406, 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 f3c3ab2c82..efe71421db 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 @@ -569,12 +569,16 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid count = groupDAO.getOwnGroupsCount(username, tenantId); count += groupDAO.getGroupsCount(roleList, tenantId); return count; - } catch (UserStoreException | GroupManagementDAOException | SQLException e) { - String msg = "Error occurred while retrieving group count of user '" + username + "'"; + } catch (UserStoreException e) { + String msg = "Error occurred while retrieving role list of user '" + username + "'"; log.error(msg, e); throw new GroupManagementException(msg, e); - } catch (Exception e) { - String msg = "Error occurred in getGroupCount for username '" + username + "'"; + } catch (SQLException e) { + String msg = "Error occurred while opening db connection to get group count."; + log.error(msg, e); + throw new GroupManagementException(msg, e); + } catch (GroupManagementDAOException e) { + String msg = "Error occurred while retrieving group count of user '" + username + "'"; log.error(msg, e); throw new GroupManagementException(msg, e); } finally { @@ -1002,6 +1006,13 @@ public class GroupManagementProviderServiceImpl implements GroupManagementProvid } } + /** + * This is populating group properties in to the group pass as an argument. Call should be manage the transactions. + * + * @param deviceGroup which needs to populate with properties + * @param tenantId of the caller + * @throws GroupManagementDAOException on DAO exceptions + */ private void populateGroupProperties(DeviceGroup deviceGroup, int tenantId) throws GroupManagementDAOException { if (deviceGroup != null && deviceGroup.getGroupId() > 0) { deviceGroup.setGroupProperties(this.groupDAO.getAllGroupProperties(deviceGroup.getGroupId(),