Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import org.apache.fineract.infrastructure.creditbureau.data.CreditBureauLoanProductMappingData;
import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Service;
Expand Down Expand Up @@ -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;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

}

return this.jdbcTemplate.queryForObject(sql, rm, new Object[] { loanProductId }); // NOSONAR
}

@Override
Expand Down