[ofbiz-framework] branch trunk updated: Fixed: replaceFirst sensible to variable pattern (OFBIZ-11396)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[ofbiz-framework] branch trunk updated: Fixed: replaceFirst sensible to variable pattern (OFBIZ-11396)

jleroux@apache.org
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-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
     new be3da71  Fixed: replaceFirst sensible to variable pattern (OFBIZ-11396)
be3da71 is described below

commit be3da7119c1fd42bfb08990987243f62ef14b0c9
Author: Jacques Le Roux <[hidden email]>
AuthorDate: Sat Feb 22 09:40:56 2020 +0100

    Fixed: replaceFirst sensible to variable pattern
    (OFBIZ-11396)
   
    When using variable pattern with replaceFirst you may cross issues if the
    pattern contains specific tokens. For instance on Windows with the path
    "C:\projectsASF\Git\ofbiz-framework/" you have inside the token "\p" which has
    a special meaning.
---
 framework/webtools/groovyScripts/service/AvailableServices.groovy | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/framework/webtools/groovyScripts/service/AvailableServices.groovy b/framework/webtools/groovyScripts/service/AvailableServices.groovy
index e3f0383..a03b027 100644
--- a/framework/webtools/groovyScripts/service/AvailableServices.groovy
+++ b/framework/webtools/groovyScripts/service/AvailableServices.groovy
@@ -19,6 +19,8 @@
 
 import java.util.*
 import javax.wsdl.WSDLException
+
+import org.apache.commons.lang3.StringUtils;
 import org.apache.ofbiz.base.util.Debug
 import org.apache.ofbiz.base.util.UtilXml
 import org.apache.ofbiz.base.util.UtilProperties
@@ -376,7 +378,7 @@ if (selectedService) {
         curServiceMap.defaultEntityName = defaultEntityName
         curServiceMap.invoke = invoke
         curServiceMap.location = location
-        curServiceMap.definitionLocation = curServiceModel.definitionLocation.replaceFirst("file:/" + System.getProperty("ofbiz.home") + "/", "")
+        curServiceMap.definitionLocation =  StringUtils.replaceOnce(curServiceModel.definitionLocation, "file:/" + System.getProperty("ofbiz.home") + "/", "")
         curServiceMap.requireNewTransaction = requireNewTransaction
         curServiceMap.export = export
         curServiceMap.exportBool = exportBool
@@ -564,7 +566,7 @@ if (!selectedService) {
             curServiceMap.defaultEntityName = defaultEntityName
             curServiceMap.invoke = invoke
             curServiceMap.location = location
-            curServiceMap.definitionLocation = curServiceModel.definitionLocation.replaceFirst("file:/" + System.getProperty("ofbiz.home") + "/", "")
+            curServiceMap.definitionLocation =  StringUtils.replaceOnce(curServiceModel.definitionLocation, "file:/" + System.getProperty("ofbiz.home") + "/", "")
             curServiceMap.requireNewTransaction = requireNewTransaction
             curServiceMap.deprecated = curServiceModel.deprecatedUseInstead