[
https://issues.apache.org/jira/browse/OFBIZ-11396?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17042397#comment-17042397 ]
ASF subversion and git services commented on OFBIZ-11396:
---------------------------------------------------------
Commit 549543ace5d7a67622b16aecafc9a2104fb16a35 in ofbiz-framework's branch refs/heads/trunk from Jacques Le Roux
[
https://gitbox.apache.org/repos/asf?p=ofbiz-framework.git;h=549543a ]
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.
> replaceFirst sensible to variable pattern
> -----------------------------------------
>
> Key: OFBIZ-11396
> URL:
https://issues.apache.org/jira/browse/OFBIZ-11396> Project: OFBiz
> Issue Type: Bug
> Components: framework/webtools, solr
> Affects Versions: Trunk, Release Branch 17.12, Release Branch 18.12
> Reporter: Jacques Le Roux
> Assignee: Jacques Le Roux
> Priority: Major
> Fix For: 17.12.01, 18.12.01
>
>
> 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|
https://www.regular-expressions.info/unicode.html].
> I stumbled upon this issue on Windows while using webtools/control/entityref:
> {noformat}
> Caused by: java.util.regex.PatternSyntaxException: Unknown character property name {r} near index 4
> C:\projectsASF\Git\ofbiz-framework/
> ^
> at java.util.regex.Pattern.error(Pattern.java:1957) ~[?:1.8.0_202]
> at java.util.regex.Pattern.charPropertyNodeFor(Pattern.java:2783) ~[?:1.8.0_202]
> at java.util.regex.Pattern.family(Pattern.java:2738) ~[?:1.8.0_202]
> at java.util.regex.Pattern.sequence(Pattern.java:2078) ~[?:1.8.0_202]
> at java.util.regex.Pattern.expr(Pattern.java:1998) ~[?:1.8.0_202]
> at java.util.regex.Pattern.compile(Pattern.java:1698) ~[?:1.8.0_202]
> at java.util.regex.Pattern.<init>(Pattern.java:1351) ~[?:1.8.0_202]
> at java.util.regex.Pattern.compile(Pattern.java:1028) ~[?:1.8.0_202]
> at java.lang.String.replaceFirst(String.java:2178) ~[?:1.8.0_202]
> at org.apache.ofbiz.webtools.WebToolsServices.getEntityRefData(WebToolsServices.java:770) ~[main/:?]
> {noformat}
> The simplest solution is to replace replaceFirst by StringUtils.replaceOnce.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)