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

Add ClassCastException for request body json decoding #403

Merged
merged 1 commit into from
Jun 26, 2024

Conversation

Avarjana
Copy link
Contributor

Description

Handling ClassCastException at request body is required since there can be instances where the request is malformed with double array objects. It should be treated as 400 Bad Request.

@jenkins-is-staging
Copy link

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

@jenkins-is-staging
Copy link

PR builder completed
Link: https://github.com/wso2/product-is/actions/runs/9661585742
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/9661585742

@@ -775,7 +775,7 @@ public ArrayList<PatchOperation> decodeRequest(String scimResourceString) throws
patchOperation.setValues(operation.opt(SCIMConstants.OperationalConstants.VALUE));
operationList.add(patchOperation);
}
} catch (JSONException e) {
} catch (JSONException | ClassCastException e) {

Choose a reason for hiding this comment

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

Usually we should avoid runtime exceptions rather handling them.

@Avarjana Avarjana merged commit bf2982c into wso2:master Jun 26, 2024
2 checks passed
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.

3 participants