Zeyad2003 commented on code in PR #3803:
URL: https://github.com/apache/fineract/pull/3803#discussion_r1534250968


##########
fineract-core/src/main/java/org/apache/fineract/commands/service/SynchronousCommandProcessingService.java:
##########
@@ -272,7 +272,12 @@ private void publishHookEvent(final String entityName, 
final String actionName,
                 Type type = new TypeToken<Map<String, Object>>() {
 
                 }.getType();
-                Map<String, Object> myMap = gson.fromJson(command.json(), 
type);
+

Review Comment:
   Do you mean replacing the if condition to be something like that:
   
   ```java
   if (!isValidJson(command.json(), type)) {
       throw new PlatformApiDataValidationException("error.msg.invalid.json", 
"The provided JSON is invalid.", new ArrayList<>());
   }
   ```
   
   If there's something else please let me know.



##########
fineract-core/src/main/java/org/apache/fineract/commands/service/SynchronousCommandProcessingService.java:
##########
@@ -293,7 +298,12 @@ private void publishHookEvent(final String entityName, 
final String actionName,
                 } else if (result instanceof ErrorInfo ex) {
                     reqmap.put("status", "Exception");
 
+                    if (!isValidJson(ex.getMessage(), type)) {

Review Comment:
   Okay, I think this makes more sense.
   But for testing, does the existing tests are enough or do we need to add 
some other tests? (given that `publishHookEvent()` is private)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to