You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by "galovics (via GitHub)" <gi...@apache.org> on 2023/05/24 10:11:31 UTC

[GitHub] [fineract] galovics commented on a diff in pull request #3199: FINERACT-1901 : Reject loan does not lead to NullPointer

galovics commented on code in PR #3199:
URL: https://github.com/apache/fineract/pull/3199#discussion_r1203841747


##########
fineract-provider/src/main/java/org/apache/fineract/infrastructure/creditbureau/service/CreditBureauLoanProductMappingReadPlatformServiceImpl.java:
##########
@@ -100,11 +101,15 @@ public Collection<CreditBureauLoanProductMappingData> readCreditBureauLoanProduc
     @Override
     public CreditBureauLoanProductMappingData readMappingByLoanId(long loanProductId) {
         this.context.authenticatedUser();
+        try{
+            final CreditBureauLoanProductMapper rm = new CreditBureauLoanProductMapper();
+            final String sql = "select " + rm.schema() + " and cblp.loan_product_id=?";
 
-        final CreditBureauLoanProductMapper rm = new CreditBureauLoanProductMapper();
-        final String sql = "select " + rm.schema() + " and cblp.loan_product_id=?";
+            return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { loanProductId }); // NOSONAR
+        }catch(EmptyResultDataAccessException e){
+            return  null;

Review Comment:
   I don't think this is the right way to do it. The API will respond with a null response body but it should simply signal an HTTP 404 representing a resource not found situation.



-- 
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: commits-unsubscribe@fineract.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org