[
https://issues.apache.org/jira/browse/OFBIZ-11396?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Michael Brohl updated OFBIZ-11396:
----------------------------------
Fix Version/s: (was: 17.12.01)
17.12.02
> 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: 18.12.01, 17.12.02
>
>
> 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)