From ed31fa334dc93b0eb5d3ccc08513bd18e3cfe928 Mon Sep 17 00:00:00 2001 From: rushannanayakkara Date: Tue, 6 Feb 2024 20:06:04 +0530 Subject: [PATCH 1/2] Throw invalid domain name error when user store is not found for given tenant domain. --- .../carbon/user/core/common/AbstractUserStoreManager.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/org.wso2.carbon.user.core/src/main/java/org/wso2/carbon/user/core/common/AbstractUserStoreManager.java b/core/org.wso2.carbon.user.core/src/main/java/org/wso2/carbon/user/core/common/AbstractUserStoreManager.java index 8d68dc8b2af..884cbd7f300 100644 --- a/core/org.wso2.carbon.user.core/src/main/java/org/wso2/carbon/user/core/common/AbstractUserStoreManager.java +++ b/core/org.wso2.carbon.user.core/src/main/java/org/wso2/carbon/user/core/common/AbstractUserStoreManager.java @@ -7911,7 +7911,9 @@ private UserStore getUserStoreInternal(String user) throws UserStoreException { } else if (SYSTEM_DOMAIN_NAME.equalsIgnoreCase(domain)) { userStore.setSystemStore(true); } else { - throw new UserStoreException("Invalid Domain Name"); + throw new UserStoreException( String.format( UserCoreErrorConstants.ErrorMessages + .ERROR_CODE_INVALID_DOMAIN_NAME.getMessage(), domain), + UserCoreErrorConstants.ErrorMessages.ERROR_CODE_INVALID_DOMAIN_NAME.getCode()); } } From 35fc226b497fbdac69851cba07b9ecca9242726a Mon Sep 17 00:00:00 2001 From: Rushan Nanayakkara Date: Tue, 19 Mar 2024 14:44:01 +0530 Subject: [PATCH 2/2] Suggested style fix Co-authored-by: Pamoda Wimalasiri --- .../wso2/carbon/user/core/common/AbstractUserStoreManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/org.wso2.carbon.user.core/src/main/java/org/wso2/carbon/user/core/common/AbstractUserStoreManager.java b/core/org.wso2.carbon.user.core/src/main/java/org/wso2/carbon/user/core/common/AbstractUserStoreManager.java index 7ce04bfc6a3..6399712619d 100644 --- a/core/org.wso2.carbon.user.core/src/main/java/org/wso2/carbon/user/core/common/AbstractUserStoreManager.java +++ b/core/org.wso2.carbon.user.core/src/main/java/org/wso2/carbon/user/core/common/AbstractUserStoreManager.java @@ -8073,7 +8073,7 @@ private UserStore getUserStoreInternal(String user) throws UserStoreException { } else if (SYSTEM_DOMAIN_NAME.equalsIgnoreCase(domain)) { userStore.setSystemStore(true); } else { - throw new UserStoreException( String.format( UserCoreErrorConstants.ErrorMessages + throw new UserStoreException(String.format( UserCoreErrorConstants.ErrorMessages .ERROR_CODE_INVALID_DOMAIN_NAME.getMessage(), domain), UserCoreErrorConstants.ErrorMessages.ERROR_CODE_INVALID_DOMAIN_NAME.getCode()); }