gilPts commented on code in PR #517:
URL: https://github.com/apache/ofbiz-framework/pull/517#discussion_r1147831396


##########
applications/product/groovyScripts/product/promo/ProductPromoActionServices.groovy:
##########
@@ -173,18 +183,19 @@ def productGWP() {
             Iterator<String> optionProductIdTempIter = 
optionProductIds.iterator()
             productId = optionProductIdTempIter.next()
             optionProductIdTempIter.remove()
-            product = from("Product").where("productId", 
productId).cache().queryOne()
+            product = from('Product').where('productId', 
productId).cache().queryOne()
         }
         if (!product) {
             // no product found to add as GWP, just return
-            return
+            return [*:result, actionResultInfo: parameters.actionResultInfo]

Review Comment:
   IIRW This one took me some time to guess, it was revealed by 
ReturnsNullInsteadOfEmptyCollection, thus when returning [] was causing issue. 
After investigation, it is a service, and in that regard, it should return 
success or error, not nothing.
   
   
   > Fix codenarc ReturnsNullInsteadOfEmptyCollection rules : Consider 
returning a zero length collection rather than null. It is often a better 
design to return a length zero collection rather than a null reference to 
indicate that there are no results (i.e., an empty list of results). This way, 
no explicit check for null is needed by clients of the method.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscr...@ofbiz.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to