[ 
https://issues.apache.org/jira/browse/OFBIZ-11396?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17042396#comment-17042396
 ] 

ASF subversion and git services commented on OFBIZ-11396:
---------------------------------------------------------

Commit d916b92ec3c01aeecfc1cbe5ebab67419a42f5f9 in ofbiz-framework's branch 
refs/heads/release18.12 from Jacques Le Roux
[ https://gitbox.apache.org/repos/asf?p=ofbiz-framework.git;h=d916b92 ]

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)

Reply via email to