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

mridulpathak pushed a commit to branch release24.09
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/release24.09 by this push:
     new 4de1d2eb80 Fixed: lookupParty crashes on empty search criteria 
(OFBIZ-13556)
4de1d2eb80 is described below

commit 4de1d2eb80c836c00d5965e52b3e98da6e384eee
Author: Mridul Pathak <[email protected]>
AuthorDate: Tue Sep 8 12:56:58 2026 +0530

    Fixed: lookupParty crashes on empty search criteria (OFBIZ-13556)
    
    lookupParty crashed with a NullPointerException on empty search criteria, 
since performFindParty (the shared service it now delegates to, replacing 
minilang's self-contained <find-by-and>) only populates its listIt result under 
certain input conditions, and no null-check was added for the remaining case. 
Also restores minilang's explicit "No match" placeholder entry on a zero-match 
search, which the conversion silently dropped in favor of an empty result list. 
The EntityListIterator i [...]
---
 .../org/apache/ofbiz/party/party/LookupServices.groovy   | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git 
a/applications/party/src/main/groovy/org/apache/ofbiz/party/party/LookupServices.groovy
 
b/applications/party/src/main/groovy/org/apache/ofbiz/party/party/LookupServices.groovy
index 4d952f6c6c..4cc3f96e8f 100644
--- 
a/applications/party/src/main/groovy/org/apache/ofbiz/party/party/LookupServices.groovy
+++ 
b/applications/party/src/main/groovy/org/apache/ofbiz/party/party/LookupServices.groovy
@@ -18,14 +18,26 @@
 */
 package org.apache.ofbiz.party.party
 
+import org.apache.ofbiz.entity.util.EntityListIterator
+
 /*
  * lookupParty is deprecated, and only present for backward compatibility 
during the deprecation time
  */
 Map lookupParty() {
     Map serviceResult = run service: 'performFindParty', with: parameters
     List lookupResult = []
-    serviceResult.listIt.getCompleteList().each {
-        lookupResult << [label: it.firstName, value: it.partyId]
+    EntityListIterator listIt = serviceResult.listIt
+    if (listIt) {
+        try {
+            listIt.getCompleteList().each {
+                lookupResult << [label: it.firstName, value: it.partyId]
+            }
+        } finally {
+            listIt.close()
+        }
+    }
+    if (!lookupResult) {
+        lookupResult << [label: 'No match', value: '']
     }
     Map result = success()
     result.lookupResult = lookupResult

Reply via email to