-
Notifications
You must be signed in to change notification settings - Fork 649
Fix null pointer exception when the tenant is invalid #13058
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
📝 Walkthrough""" WalkthroughThe changes introduce a new condition in the Changes
Sequence Diagram(s)sequenceDiagram
participant Caller
participant APIUtil
Caller->>APIUtil: call isUserExist(username)
APIUtil->>APIUtil: Retrieve tenant ID
alt Tenant ID equals -1
APIUtil-->>Caller: throw APIManagementException (INVALID_TENANT)
else Tenant exists
APIUtil->>UserStoreManager: check user existence
UserStoreManager-->>APIUtil: return existence result
APIUtil-->>Caller: return user existence result
end
Assessment against linked issues
Suggested reviewers
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ast-grep (0.31.1)components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/utils/APIUtil.javaTip ⚡️ Faster reviews with caching
Enjoy the performance boost—your workflow just got faster. 📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (7)
✨ Finishing Touches
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
Purpose
When trying to change the API Provider through admin portal, if an invalid tenant name is given as input, (
john@ a bc.com
-> space within the tenant domain or[email protected]
wheretest.com
does not exist) an NPE is thrown. This PR fixes that issue.Fixes: wso2/api-manager#3735
Implementation Details
If the tenant is invalid, the
tenantId
becomes-1
. If that happens, anAPIManagementException
is now thrown withINVALID_TENANT
as the ExceptionCode.