[ 
https://issues.apache.org/jira/browse/WW-5311?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

David Vanacker updated WW-5311:
-------------------------------
    Description: 
This following snippet works as expected on Struts 6.0.3, but fails on 6.1.x.
 
{code:java}
import org.junit.Test;

import com.opensymphony.xwork2.util.NamedVariablePatternMatcher;

public class NamedVariablePatternMatcherTest {

    @Test
    public void test() {
        new 
NamedVariablePatternMatcher().compilePattern("/{first}/two/{third}");
        new NamedVariablePatternMatcher().compilePattern("/first/two/{third}");
        new 
NamedVariablePatternMatcher().compilePattern("/first/{two}/{third}");
        new 
NamedVariablePatternMatcher().compilePattern("/{first}/{two}/third"); // 
java.lang.IllegalArgumentException: Missing openning '{' in [/ 
{first}/{two}/third]!         
        new NamedVariablePatternMatcher().compilePattern("/{first}/two"); 
//java.lang.IllegalArgumentException: Missing openning '{' in [/{first}
/two]!     }
} {code}

 

 
 
 
 

  was:
This following snippet works as expected on Struts 6.0.3, but fails on 6.1.x.
 
new NamedVariablePatternMatcher().compilePattern("/\{first}/two/\{third}"); // 
Success

new NamedVariablePatternMatcher().compilePattern("/first/two/\{third}"); // 
Success

new NamedVariablePatternMatcher().compilePattern("/first/\{two}/\{third}"); // 
Success

new NamedVariablePatternMatcher().compilePattern("/\{first}/\{two}/third"); // 
java.lang.IllegalArgumentException: Missing openning '\{' in 
[/{first}/\{two}/third]!
 
new NamedVariablePatternMatcher().compilePattern("/\{first}/two"); 
//java.lang.IllegalArgumentException: Missing openning '{' in [/{first}/two]!
 


 
 

 
 
 
 


> NamedVariablePatternMatcher throws an IllegalArgumentException when named 
> variable is not the last part of the sequence
> -----------------------------------------------------------------------------------------------------------------------
>
>                 Key: WW-5311
>                 URL: https://issues.apache.org/jira/browse/WW-5311
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 6.1.1, 6.1.2
>            Reporter: David Vanacker
>            Priority: Major
>              Labels: regresion
>
> This following snippet works as expected on Struts 6.0.3, but fails on 6.1.x.
>  
> {code:java}
> import org.junit.Test;
> import com.opensymphony.xwork2.util.NamedVariablePatternMatcher;
> public class NamedVariablePatternMatcherTest {
>     @Test
>     public void test() {
>         new 
> NamedVariablePatternMatcher().compilePattern("/{first}/two/{third}");
>         new 
> NamedVariablePatternMatcher().compilePattern("/first/two/{third}");
>         new 
> NamedVariablePatternMatcher().compilePattern("/first/{two}/{third}");
>         new 
> NamedVariablePatternMatcher().compilePattern("/{first}/{two}/third"); // 
> java.lang.IllegalArgumentException: Missing openning '{' in [/ 
> {first}/{two}/third]!         
>         new NamedVariablePatternMatcher().compilePattern("/{first}/two"); 
> //java.lang.IllegalArgumentException: Missing openning '{' in [/{first}
> /two]!     }
> } {code}
>  
>  
>  
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to