This is an automated email from the ASF dual-hosted git repository.
mridulpathak pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
The following commit(s) were added to refs/heads/trunk by this push:
new facd72ccb5 Fixed: createFuturePeriod() crashes with
NullPointerException when CustomTimePeriod SystemProperty config is missing
(OFBIZ-13604)
facd72ccb5 is described below
commit facd72ccb5c4a4f95b4d131b79a370f50316c40b
Author: Mridul Pathak <[email protected]>
AuthorDate: Sat Sep 19 20:21:33 2026 +0530
Fixed: createFuturePeriod() crashes with NullPointerException when
CustomTimePeriod SystemProperty config is missing (OFBIZ-13604)
createFuturePeriod() looked up the "CustomTimePeriod.create" SystemProperty
and accessed .systemPropertyValue on the result with no null check. That
SystemProperty row only exists in
framework/common/data/CommonSystemPropertyData.xml,
whose <entity-resource> is commented out in ofbiz-component.xml
("multitenant"
opt-in), so on a standard install with no such row configured this threw a
NullPointerException instead of gracefully treating "not configured" as
"nothing to do." createFuturePeriod is registered as a recurring scheduled
job (JobSandbox jobId=FUTURE_PERIOD, running the 1st and 15th of every
month), so this crashed that job indefinitely on any install with at least
one PartyAcctgPreference.enableAccounting='Y' row and no explicit
SystemProperty configured -- the default, out-of-the-box state. The same
gap existed one line later for the CustomTimePeriod.applType lookup.
Fixed with safe-navigation on both lookups. Verified with a temporary
RED/GREEN test; full accounting component suite passes.
---
.../org/apache/ofbiz/accounting/admin/AcctgAdminServices.groovy | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git
a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/admin/AcctgAdminServices.groovy
b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/admin/AcctgAdminServices.groovy
index 659986c995..c2032de6e4 100644
---
a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/admin/AcctgAdminServices.groovy
+++
b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/admin/AcctgAdminServices.groovy
@@ -179,11 +179,11 @@ Map createFuturePeriod() {
parameters.organizationPartyId = it.partyId
createCustomTimePeriod = from('SystemProperty')
.where('systemResourceId', 'general', 'systemPropertyId',
'CustomTimePeriod.create').queryOne()
- if (createCustomTimePeriod.systemPropertyValue == 'Y') {
+ if (createCustomTimePeriod?.systemPropertyValue == 'Y') {
// get list of CustomTypePeriod types
applTypes = from('SystemProperty')
.where('systemResourceId', 'general', 'systemPropertyId',
'CustomTimePeriod.applType').queryOne()
- List types =
Arrays.asList(applTypes.systemPropertyValue.split('\\s*,\\s*'))
+ List types = applTypes?.systemPropertyValue ?
Arrays.asList(applTypes.systemPropertyValue.split('\\s*,\\s*')) : []
types.each { periodTypeId ->
Calendar periodCal = Calendar.getInstance()
systemPropertyId = 'CustomTimePeriod.' + periodTypeId +
'.intermediate'