-
Notifications
You must be signed in to change notification settings - Fork 53
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
fix : update notification-invoke-service to accept list of notificati… #1133
fix : update notification-invoke-service to accept list of notificati… #1133
Conversation
…ons or single notification in the payload
a41e73b
to
1d4c851
Compare
SonarCloud Quality Gate failed. |
|
||
Object payloadObj = gson.fromJson(payloadString,Object.class); | ||
if(payloadObj instanceof List){ | ||
List<Object> notificationRequestList = gson.fromJson(payloadString,List.class); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@raviteja-mandala @santhosh-challa this line is an error. when sending a object (not an array of events), the code falls through the first if and considers the object to be a list as well
@@ -40,6 +40,26 @@ public String handleRequest(Map<String,Object> event, Context context) | |||
System.out.println("bodyJson--"+bodyJson.toString()); | |||
payloadString = bodyJson.getAsJsonObject().get("Sns").getAsJsonObject().get("Message").getAsString(); | |||
} | |||
|
|||
Object payloadObj = gson.fromJson(payloadString,Object.class); | |||
if(payloadObj instanceof List){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this line here is what allowing the single events to fall through here. This "if" statement is not working as intended for single objects
…ons or single notification in the payload
Description
Please include a summary of the changes and the related issue. Please also include relevant motivation and context. List
any dependencies that are required for this change.
Fixes # (issue)
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also
list any relevant details for your test configuration
Checklist:
Other information:
List any documentation updates that are needed for the Wiki