This is an automated email from the ASF dual-hosted git repository.

ashishvijaywargiya 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 08e95fbae8 Fix null-unsafe party name concatenation in RateServices 
error log (#1658)
08e95fbae8 is described below

commit 08e95fbae830e42580cb357772a5db64862f66de
Author: Ashish Vijaywargiya <[email protected]>
AuthorDate: Sun Aug 16 14:33:27 2026 +0530

    Fix null-unsafe party name concatenation in RateServices error log (#1658)
    
    When no rate entry is found, the error message concatenated the party's
    lastName, middleName, firstName and groupName directly, so a party with
    no name fields set produced the literal text nullnullnullnull instead of
    an empty string. Also guard rateType and periodType with safe navigation
    since the same queryOne lookups can return null.
---
 .../groovy/org/apache/ofbiz/accounting/rate/RateServices.groovy   | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git 
a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/rate/RateServices.groovy
 
b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/rate/RateServices.groovy
index 7de382ff39..dd07af61d6 100644
--- 
a/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/rate/RateServices.groovy
+++ 
b/applications/accounting/src/main/groovy/org/apache/ofbiz/accounting/rate/RateServices.groovy
@@ -224,9 +224,11 @@ Map getRatesAmountsFrom(String field) {
         GenericValue periodType = 
from('PeriodType').where(parameters).queryOne()
         GenericValue rateType = from('RateType').where(parameters).queryOne()
         GenericValue partyNameView = 
from('PartyNameView').where(parameters).queryOne()
-        logError('A valid rate entry could be found for rateType:' + 
rateType.description + ', ' + entityName + ':' + parameters.get(field)
-                + ', party: ' + partyNameView.lastName + 
partyNameView.middleName + partyNameView.firstName + partyNameView.groupName
-                + ' However.....not for the period:' + periodType.description 
+ ' and currency:' + parameters.rateCurrencyUomId)
+        String partyName = partyNameView ? [partyNameView.lastName, 
partyNameView.middleName, partyNameView.firstName,
+                partyNameView.groupName].findAll { it }.join(' ') : ''
+        logError('A valid rate entry could be found for rateType:' + 
rateType?.description + ', ' + entityName + ':' + parameters.get(field)
+                + ', party: ' + partyName
+                + ' However.....not for the period:' + periodType?.description 
+ ' and currency:' + parameters.rateCurrencyUomId)
     }
     Map result = success()
     result.ratesList = ratesList

Reply via email to