angelboxes commented on a change in pull request #683: FINERACT-824: 
NullPointerException is thrown when submitting a loan account application with 
an existing externalId
URL: https://github.com/apache/fineract/pull/683#discussion_r365624691
 
 

 ##########
 File path: 
fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/service/LoanApplicationWritePlatformServiceJpaRepositoryImpl.java
 ##########
 @@ -1036,12 +1036,11 @@ else if(existingLoanApplication.getGroup() != null){
      */
     private void handleDataIntegrityIssues(final JsonCommand command, final 
Throwable realCause, final Exception dve) {
        
-        if (realCause.getMessage().contains("loan_account_no_UNIQUE") || 
realCause.getCause().getMessage().contains("loan_account_no_UNIQUE")) {
-
+        if (realCause.getMessage().contains("loan_account_no_UNIQUE")) {
             final String accountNo = 
command.stringValueOfParameterNamed("accountNo");
             throw new 
PlatformDataIntegrityException("error.msg.loan.duplicate.accountNo", "Loan with 
accountNo `" + accountNo
                     + "` already exists", "accountNo", accountNo);
-        } else if (realCause.getMessage().contains("loan_externalid_UNIQUE") 
|| realCause.getCause().getMessage().contains("loan_externalid_UNIQUE")) {
 
 Review comment:
   Yeah, actually that was my first approach to this issue however I saw that 
this is not the only place where unique values exceptions are thrown but this 
is the only place where such validation is done. and thought that it was one of 
those changes that worked when it was added but a different one made it useless 
and that maybe it wasn't needed,. Don't worry I will change it as you propose.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to