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/15 12:50:00 UTC

[jira] [Commented] (OFBIZ-13584) createUpdateBillingAddressAndPaymentMethod NPEs on a null userLogin

    [ https://issues.apache.org/jira/browse/OFBIZ-13584?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18115585#comment-18115585 ] 

ASF subversion and git services commented on OFBIZ-13584:
---------------------------------------------------------

Commit 5f1730bdf686335f86cfe34e3fc72da860a69e78 in ofbiz-framework's branch refs/heads/trunk from Mridul Pathak
[ https://gitbox.apache.org/repos/asf?p=ofbiz-framework.git;h=5f1730bdf6 ]

Fixed: createUpdateBillingAddressAndPaymentMethod throws NPE for anonymous checkout (OFBIZ-13584)

The method dereferenced userLogin.userLoginId without checking userLogin for null first, throwing a NullPointerException whenever a partyId is present but the shopping cart has no associated userLogin (an anonymous checkout carrying a resolved party from elsewhere). The original minilang's dotted-field access degraded gracefully to null in that case instead of crashing. The guard now checks userLogin is non-null before accessing userLoginId, matching the pattern already used in the sibling method createUpdateCustomerAndShippingAddress in the same file.


> createUpdateBillingAddressAndPaymentMethod NPEs on a null userLogin
> -------------------------------------------------------------------
>
>                 Key: OFBIZ-13584
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-13584
>             Project: OFBiz
>          Issue Type: Bug
>          Components: order
>    Affects Versions: Upcoming Branch, 24.09.07
>            Reporter: Mridul Pathak
>            Assignee: Mridul Pathak
>            Priority: Major
>
> {{createUpdateBillingAddressAndPaymentMethod}} does:
> {code:groovy}
> if (partyId) {
>     if (userLogin.userLoginId == 'anonymous') {
>         userLogin.partyId = partyId
>     }
> }
> {code}
> with no null-check on {{userLogin}}. The original minilang's {{FlexibleMapAccessor}}/{{CompareCondition}} silently evaluate to false for a field rooted in a null object, so it degraded gracefully when {{userLogin}} was null; Groovy throws a {{NullPointerException}} instead. The sibling method {{createUpdateCustomerAndShippingAddress}} in the same file correctly guards this with {{if (userLogin) {...}}} — this method is the outlier.
> Needs fixing: wrap the block in {{if (userLogin) { ... }}}, matching the sibling method.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)