adamsaghy commented on code in PR #3933:
URL: https://github.com/apache/fineract/pull/3933#discussion_r1640000500


##########
fineract-core/src/main/java/org/apache/fineract/commands/service/CommandSourceService.java:
##########
@@ -64,8 +66,15 @@ public CommandSource 
saveInitialSameTransaction(CommandWrapper wrapper, JsonComm
 
     @NotNull
     private CommandSource saveInitial(CommandWrapper wrapper, JsonCommand 
jsonCommand, AppUser maker, String idempotencyKey) {
-        CommandSource initialCommandSource = getInitialCommandSource(wrapper, 
jsonCommand, maker, idempotencyKey);
-        return commandSourceRepository.saveAndFlush(initialCommandSource);
+        try {
+            CommandSource initialCommandSource = 
getInitialCommandSource(wrapper, jsonCommand, maker, idempotencyKey);
+            return commandSourceRepository.saveAndFlush(initialCommandSource);
+        } catch (JpaSystemException jse) {
+            if 
(jse.getRootCause().getMessage().contains("UNIQUE_PORTFOLIO_COMMAND_SOURCE")) {

Review Comment:
   Please use null checks! Root cause and message both can be null!



-- 
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