diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/subscription/mgt/impl/RoleBasedSubscriptionManagementHelperServiceImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/subscription/mgt/impl/RoleBasedSubscriptionManagementHelperServiceImpl.java index d86534b073..29d4fa7931 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/subscription/mgt/impl/RoleBasedSubscriptionManagementHelperServiceImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/subscription/mgt/impl/RoleBasedSubscriptionManagementHelperServiceImpl.java @@ -225,7 +225,7 @@ public class RoleBasedSubscriptionManagementHelperServiceImpl implements Subscri } private int getDeviceIdsOwnByRoleWithType(String roleName, int tenantId, ApplicationReleaseDTO applicationReleaseDTO) - throws UserStoreException, DeviceManagementException { + throws UserStoreException, DeviceManagementException, ApplicationManagementException { UserStoreManager userStoreManager = DataHolder.getInstance().getRealmService() .getTenantUserRealm(tenantId).getUserStoreManager(); String[] usersWithRole = userStoreManager.getUserListOfRole(roleName); @@ -236,7 +236,7 @@ public class RoleBasedSubscriptionManagementHelperServiceImpl implements Subscri } catch (ApplicationManagementDAOException e) { String msg = "Error encountered while accessing application management data."; log.error(msg, e); - throw new DeviceManagementException(msg, e); + throw new ApplicationManagementException(msg, e); } for (String user : usersWithRole) { try { @@ -248,9 +248,6 @@ public class RoleBasedSubscriptionManagementHelperServiceImpl implements Subscri } catch (DeviceManagementDAOException e) { String msg = String.format("Error encountered while accessing device management data for user: %s", user); log.error(msg, e); - } catch (Exception e) { - String msg = String.format("Unexpected error occurred for user: %s", user); - log.error(msg, e); } } return idCountOwnByRole; diff --git a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/subscription/mgt/impl/UserBasedSubscriptionManagementHelperServiceImpl.java b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/subscription/mgt/impl/UserBasedSubscriptionManagementHelperServiceImpl.java index 021e829c4d..4f59cbe7dd 100644 --- a/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/subscription/mgt/impl/UserBasedSubscriptionManagementHelperServiceImpl.java +++ b/components/application-mgt/io.entgra.device.mgt.core.application.mgt.core/src/main/java/io/entgra/device/mgt/core/application/mgt/core/util/subscription/mgt/impl/UserBasedSubscriptionManagementHelperServiceImpl.java @@ -187,12 +187,10 @@ public class UserBasedSubscriptionManagementHelperServiceImpl implements Subscri applicationDAO.getApplication(applicationReleaseDTO.getUuid(), tenantId).getDeviceTypeId(), subscriptionInfo.getIdentifier(), null); int allDeviceCount = devices.size(); return SubscriptionManagementHelperUtil.getSubscriptionStatistics(subscriptionStatisticDTO, allDeviceCount); - } catch (DeviceManagementException | ApplicationManagementDAOException e) { + } catch (DeviceManagementException | ApplicationManagementDAOException | DeviceManagementDAOException e) { String msg = "Error encountered while getting subscription statistics for user: " + subscriptionInfo.getIdentifier(); log.error(msg, e); throw new ApplicationManagementException(msg, e); - } catch (DeviceManagementDAOException e) { - throw new RuntimeException(e); } finally { ConnectionManagerUtil.closeDBConnection(); } diff --git a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractGroupDAOImpl.java b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractGroupDAOImpl.java index 448230d0a5..fc6f6b23c8 100644 --- a/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractGroupDAOImpl.java +++ b/components/device-mgt/io.entgra.device.mgt.core.device.mgt.core/src/main/java/io/entgra/device/mgt/core/device/mgt/core/dao/impl/AbstractGroupDAOImpl.java @@ -1620,6 +1620,4 @@ public abstract class AbstractGroupDAOImpl implements GroupDAO { throw new GroupManagementDAOException(msg, e); } } -} - - +} \ No newline at end of file