[
https://issues.apache.org/jira/browse/FINERACT-2182?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Felix Van Hove updated FINERACT-2182:
-------------------------------------
Summary: Group creation fails due to NullPointerException when
random-account-number=enabled (was: Group creation fails due to )
> Group creation fails due to NullPointerException when
> random-account-number=enabled
> -----------------------------------------------------------------------------------
>
> Key: FINERACT-2182
> URL: https://issues.apache.org/jira/browse/FINERACT-2182
> Project: Apache Fineract
> Issue Type: Bug
> Components: Groups
> Reporter: Felix Van Hove
> Priority: Minor
>
> Someone (history on Slack #fineract 2025-02-16) attempted to create a simple
> group via the Mifos client. This failed with the following stack trace on the
> side of Fineract:
> ??java.lang.NullPointerException: Cannot invoke "String.equals(Object)"
> because "entityType" is null??
> ?? at
> org.apache.fineract.portfolio.account.service.AccountNumberGenerator.checkAccountNumberConflict(AccountNumberGenerator.java:200)??
> ?? at
> org.apache.fineract.portfolio.account.service.AccountNumberGenerator.generateAccountNumber(AccountNumberGenerator.java:175)??
> ?? at
> org.apache.fineract.portfolio.account.service.AccountNumberGenerator.generateGroupAccountNumber(AccountNumberGenerator.java:243)??
> ?? at
> org.apache.fineract.portfolio.group.service.GroupingTypesWritePlatformServiceJpaRepositoryImpl.generateAccountNumberIfRequired(GroupingTypesWritePlatformServiceJpaRepositoryImpl.java:243)??
> ?? at
> org.apache.fineract.portfolio.group.service.GroupingTypesWritePlatformServiceJpaRepositoryImpl.createGroupingType(GroupingTypesWritePlatformServiceJpaRepositoryImpl.java:198)??
> ?? at
> org.apache.fineract.portfolio.group.service.GroupingTypesWritePlatformServiceJpaRepositoryImpl.createGroup(GroupingTypesWritePlatformServiceJpaRepositoryImpl.java:274)??
> ?? at
> java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)??
> Looking at the _AccountNumberGenerator.java_ it's clear this user's
> c_configuration table had random-account-number=enabled. (This might explain,
> why the problem hasn't popped up before.) In its current state, the method
> _checkAccountNumberConflict_ requires _entityType_ to be in some property
> map. But looking up the call stack, the _entityType_ can't be in the map. The
> map is built in line 240ff.
> The same bug might affect two other public generate* methods of this class.
> They need to be adjusted too. (And why are there two public methods at the
> bottom of the class? I suggest to move them up to the other public methods.)
> For people working with random account numbers, this looks important.
> Commit 39d95f3
> [https://github.com/apache/fineract/blob/develop/fineract-provider/src/main/java/org/apache/fineract/portfolio/account/service/AccountNumberGenerator.java]
>
--
This message was sent by Atlassian Jira
(v8.20.10#820010)