You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@fineract.apache.org by "Ashhar Ahmad Khan (Jira)" <ji...@apache.org> on 2026/09/04 10:30:00 UTC
[jira] [Created] (FINERACT-2808) NullPointerException in GroupingTypesWritePlatformServiceJpaRepositoryImpl when GroupLevel is missing
Ashhar Ahmad Khan created FINERACT-2808:
-------------------------------------------
Summary: NullPointerException in GroupingTypesWritePlatformServiceJpaRepositoryImpl when GroupLevel is missing
Key: FINERACT-2808
URL: https://issues.apache.org/jira/browse/FINERACT-2808
Project: Apache Fineract
Issue Type: Bug
Reporter: Ashhar Ahmad Khan
What is broken
GroupingTypesWritePlatformServiceJpaRepositoryImpl fetches a GroupLevel via groupLevelRepository.findById(id).orElse(null) in two places, createGroupingType and updateGroupingType, and dereferences the result immediately with no null check. If the group references a GroupLevel that does not exist in the database, this throws an unhandled NullPointerException, blocking group creation or update.
Why it's broken
The correct pattern already exists elsewhere in the same file, findOneWithNotFoundDetection style lookups that throw a proper not found exception instead of returning null. This convention was never applied to the two GroupLevel lookups.
Changes made
Both .orElse(null) calls in GroupingTypesWritePlatformServiceJpaRepositoryImpl replaced with .orElseThrow(() -> new GroupLevelNotFoundException(id)), using the existing GroupLevelNotFoundException class.
Added GroupingTypesWritePlatformServiceJpaRepositoryImplTest.java, a regression test confirming updateGroup throws GroupLevelNotFoundException when the referenced GroupLevel is missing.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)