Skip to content
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

Handle Null Pointer Exception while trying to delete already deleted Authorized API #2607

Merged
merged 4 commits into from
Nov 4, 2024

Conversation

kumardeepak5
Copy link
Contributor

Purpose

This PR may resolve wso2/product-is#21260

Goals

This PR addresses a NullPointerException that occurs when attempting to delete an already deleted Authorized API.

Behavior After Fix:

Below are the Sample Request & response.
Request [Delete already deleted Authorized API]

curl --location --request DELETE 'https://localhost:9443/api/server/v1/applications/<applcation-id>/authorized-apis/<api-id>' \
--header 'Authorization: Basic <username:password>'

Response [Delete already deleted Authorized API]
Response Code - 204
Empty Response Body

@CLAassistant
Copy link

CLAassistant commented Oct 25, 2024

CLA assistant check
All committers have signed the CLA.

@@ -243,7 +243,7 @@ public void handleEvent(Event event) throws IdentityEventException {
AuthorizedAPI authorizedAPI = OAuthComponentServiceHolder.getInstance()
.getAuthorizedAPIManagementService()
.getAuthorizedAPI(appId, apiId, tenantDomain);
if (authorizedAPI.getScopes() == null) {
if (null == authorizedAPI || authorizedAPI.getScopes() == null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: Could we consider changing this to

if (authorizedAPI == null || authorizedAPI.getScopes() == null) { instead?

This approach is more commonly used in the codebase and may be slightly more readable.

@jenkins-is-staging
Copy link

PR builder started
Link: https://github.com/wso2/product-is/actions/runs/11663312625

Copy link

codecov bot commented Nov 4, 2024

Codecov Report

Attention: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Project coverage is 54.81%. Comparing base (afd5acb) to head (be3c0bb).
Report is 51 commits behind head on master.

Files with missing lines Patch % Lines
...tity/oauth/listener/IdentityOauthEventHandler.java 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #2607      +/-   ##
============================================
- Coverage     56.23%   54.81%   -1.43%     
- Complexity     8128     8632     +504     
============================================
  Files           632      632              
  Lines         46158    49534    +3376     
  Branches       7771     8724     +953     
============================================
+ Hits          25956    27150    +1194     
- Misses        16478    18490    +2012     
- Partials       3724     3894     +170     
Flag Coverage Δ
unit 38.69% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jenkins-is-staging
Copy link

PR builder completed
Link: https://github.com/wso2/product-is/actions/runs/11663312625
Status: success

Copy link

@jenkins-is-staging jenkins-is-staging left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving the pull request based on the successful pr build https://github.com/wso2/product-is/actions/runs/11663312625

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Null Pointer Exception Thrown When Deleting an Already Deleted Authorized API from Application
6 participants