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.
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user