adamsaghy commented on code in PR #5319:
URL: https://github.com/apache/fineract/pull/5319#discussion_r2694248085
##########
fineract-provider/src/main/java/org/apache/fineract/portfolio/account/service/AccountAssociationsReadPlatformServiceImpl.java:
##########
@@ -99,7 +99,16 @@ public boolean isLinkedWithAnyActiveAccount(final Long
savingsId) {
final List<Map<String, Object>> statusList =
this.jdbcTemplate.queryForList(sql1, savingsId);
for (final Map<String, Object> statusMap : statusList) {
- AccountAssociationType associationType =
AccountAssociationType.fromInt((Integer) statusMap.get("type"));
+ Object typeObject = statusMap.get("type");
+ if (typeObject == null) {
+ // Handle the case where 'type' is missing or null if
necessary, e.g., continue or throw a specific
+ // exception
+ continue; // Skip this map if the type is null
+ }
+
+ // Safely cast to Number and get the int value, which handles
Short, Integer, etc.
+ Integer typeValue = ((Number) typeObject).intValue();
+ AccountAssociationType associationType =
AccountAssociationType.fromInt(typeValue);
Review Comment:
`type` cannot be `null` (its nullable=false) in database. Lets just fix the
conversion, and undo all the rest of this.
You only need to use `(int)` which would work with `Integer` and with
`Short` too.
--
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]