You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2022/10/11 05:35:16 UTC

[ofbiz-plugins] branch trunk updated: Improved: Use replace() instead of replaceAll() when a regex is not used (OFBIZ-10934)

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

jleroux pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-plugins.git


The following commit(s) were added to refs/heads/trunk by this push:
     new 564d749b9 Improved: Use replace() instead of replaceAll() when a regex is not used (OFBIZ-10934)
564d749b9 is described below

commit 564d749b9656f4ea4fe6d225b255de5836bf3c42
Author: Jacques Le Roux <ja...@les7arts.com>
AuthorDate: Tue Oct 11 07:35:38 2022 +0200

    Improved: Use replace() instead of replaceAll() when a regex is not used (OFBIZ-10934)
    
    Increases performance and clarify usage of replaceAll() in Groovy too
---
 ecommerce/groovyScripts/catalog/ProductCategories.groovy | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ecommerce/groovyScripts/catalog/ProductCategories.groovy b/ecommerce/groovyScripts/catalog/ProductCategories.groovy
index e2002c83d..b6edea15f 100644
--- a/ecommerce/groovyScripts/catalog/ProductCategories.groovy
+++ b/ecommerce/groovyScripts/catalog/ProductCategories.groovy
@@ -40,10 +40,10 @@ List fillTree(rootCat ,CatLvl, parentCategoryId) {
             // CatLvl uses for identify the Category level for display different css class
             if(catChilds) {
                 if(CatLvl==2)
-                    childList = fillTree(catChilds,CatLvl+1, parentCategoryId.replaceAll("/", "")+'/'+root.productCategoryId)
+                    childList = fillTree(catChilds,CatLvl+1, parentCategoryId.replace("/", "")+'/'+root.productCategoryId)
                     // replaceAll and '/' uses for fix bug in the breadcrum for href of category
                 else if(CatLvl==1)
-                    childList = fillTree(catChilds,CatLvl+1, parentCategoryId.replaceAll("/", "")+root.productCategoryId)
+                    childList = fillTree(catChilds,CatLvl+1, parentCategoryId.replace("/", "")+root.productCategoryId)
                 else
                     childList = fillTree(catChilds,CatLvl+1, parentCategoryId+'/'+root.productCategoryId)
             }