diff --git a/framework/base/src/main/java/org/apache/ofbiz/base/util/string/UelFunctions.java b/framework/base/src/main/java/org/apache/ofbiz/base/util/string/UelFunctions.java index d0b99adab7..d01e338c81 100644 --- a/framework/base/src/main/java/org/apache/ofbiz/base/util/string/UelFunctions.java +++ b/framework/base/src/main/java/org/apache/ofbiz/base/util/string/UelFunctions.java @@ -41,6 +41,7 @@ import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerFactory; import javax.xml.transform.stream.StreamSource; +import org.apache.commons.lang3.StringUtils; import org.apache.ofbiz.base.location.FlexibleLocation; import org.apache.ofbiz.base.util.Debug; import org.apache.ofbiz.base.util.FileUtil; @@ -374,10 +375,8 @@ public class UelFunctions { } public static String replaceFirst(String str1, String str2, String str3) { - try { - return str1.replaceFirst(str2, str3); - } catch (Exception e) {} - return null; + if (null == str1) return null; + return StringUtils.replaceOnce(str1, str2, str3); } public static boolean startsWith(String str1, String str2) { diff --git a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/WebToolsServices.java b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/WebToolsServices.java index 3f25c61a80..4e660a39e5 100644 --- a/framework/webtools/src/main/java/org/apache/ofbiz/webtools/WebToolsServices.java +++ b/framework/webtools/src/main/java/org/apache/ofbiz/webtools/WebToolsServices.java @@ -48,6 +48,7 @@ import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; +import org.apache.commons.lang3.StringUtils; import org.apache.ofbiz.base.location.FlexibleLocation; import org.apache.ofbiz.base.util.Debug; import org.apache.ofbiz.base.util.GeneralException; @@ -761,7 +762,7 @@ public class WebToolsServices { entityMap.put("title", entity.getTitle()); entityMap.put("description", entityDescription); String entityLocation = entity.getLocation(); - entityLocation = entityLocation.replaceFirst(System.getProperty("ofbiz.home") + "/", ""); + entityLocation = StringUtils.replaceOnce(entityLocation, System.getProperty("ofbiz.home") + "/", ""); entityMap.put("location", entityLocation); entityMap.put("javaNameList", javaNameList); entityMap.put("relationsList", relationsList);