You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ofbiz.apache.org by "ASF subversion and git services (Jira)" <ji...@apache.org> on 2026/09/19 15:42:00 UTC
[jira] [Commented] (OFBIZ-13604) createFuturePeriod() crashes with NullPointerException when CustomTimePeriod SystemProperty config is missing
[ https://issues.apache.org/jira/browse/OFBIZ-13604?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18117089#comment-18117089 ]
ASF subversion and git services commented on OFBIZ-13604:
---------------------------------------------------------
Commit facd72ccb5c4a4f95b4d131b79a370f50316c40b in ofbiz-framework's branch refs/heads/trunk from Mridul Pathak
[ https://gitbox.apache.org/repos/asf?p=ofbiz-framework.git;h=facd72ccb5 ]
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.
> createFuturePeriod() crashes with NullPointerException when CustomTimePeriod SystemProperty config is missing
> -------------------------------------------------------------------------------------------------------------
>
> Key: OFBIZ-13604
> URL: https://issues.apache.org/jira/browse/OFBIZ-13604
> Project: OFBiz
> Issue Type: Bug
> Components: accounting
> Affects Versions: Upcoming Branch, 24.09.07
> Reporter: Mridul Pathak
> Assignee: Mridul Pathak
> Priority: Major
>
> h3. Needs fixing
> {{applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/admin/AcctgAdminServices.groovy}}'s {{createFuturePeriod()}} looks up the {{CustomTimePeriod.create}} {{SystemProperty}} and accesses {{.systemPropertyValue}} on the result with no null check. That {{SystemProperty}} row only exists in {{framework/common/data/CommonSystemPropertyData.xml}}, whose {{<entity-resource>}} registration is commented out in {{ofbiz-component.xml}} ("multitenant" opt-in) — so on a standard install with no such row configured, this throws 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, {{maxRecurrenceCount="-1"}}) loaded via the {{demo}} data reader. So this crashes that job indefinitely on any install that loaded demo data and has at least one {{PartyAcctgPreference.enableAccounting='Y'}} row, with no explicit {{SystemProperty}} configuration — the default, out-of-the-box state.
> The same gap exists one line later for the {{CustomTimePeriod.applType}} lookup, reachable if {{.create}} is explicitly set to {{'Y'}} but {{.applType}} is left unconfigured.
> Needs fixing: use safe-navigation ({{createCustomTimePeriod?.systemPropertyValue}}) and guard the {{applType}} lookup the same way, so a missing configuration is treated as "skip," not a crash.
> Acceptance criteria: fixed, with a regression test that calls {{createFuturePeriod}} with an {{enableAccounting='Y'}} party and no {{CustomTimePeriod.*}} SystemProperty configured, asserting the service succeeds gracefully instead of throwing.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)