struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ken McWilliams (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (WW-3985) Action mapping *x* resolves to * however *xx* works as expected
Date Sun, 17 Feb 2013 11:21:13 GMT

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

Ken McWilliams updated WW-3985:
-------------------------------

    Description: 
When using the default pattern matcher "WildcardHelper" the following action mapping behaves
as if it was "*"

        <action name="**_**">
            <result>/WEB-INF/content/testmapping.jsp</result>
        </action>

That is, the underscore (or any other single character) is ignored and the action will map
as if it "*".

I thought it was the fault of WildcardHelper so created test cases and they all passed...

    @Test
    public void testMatch() {
        WildcardHelper wild = new WildcardHelper();
        HashMap<String, String> matchedPatterns = new HashMap<String, String>();
        int[] pattern = wild.compilePattern("*b*");
        assertEquals(wild.match(matchedPatterns, "b", pattern), true);
        assertEquals(wild.match(matchedPatterns, "abc", pattern), true);
        assertEquals(wild.match(matchedPatterns, "xxx", pattern), false);

        pattern = wild.compilePattern("*_*");
        assertEquals(wild.match(matchedPatterns, "a_a", pattern), true);
        assertEquals(wild.match(matchedPatterns, "a", pattern), false);
    }

  was:
When using the default pattern matcher "WildcardHelper" the following action mapping behaves
as if it was "*"

        <action name="*_*">
            <result>/WEB-INF/content/testmapping.jsp</result>
        </action>

That is, the underscore (or any other single character) is ignored and the action will map
as if it "*".

I thought it was the fault of WildcardHelper so created test cases and they all passed...

    @Test
    public void testMatch() {
        WildcardHelper wild = new WildcardHelper();
        HashMap<String, String> matchedPatterns = new HashMap<String, String>();
        int[] pattern = wild.compilePattern("*b*");
        assertEquals(wild.match(matchedPatterns, "b", pattern), true);
        assertEquals(wild.match(matchedPatterns, "abc", pattern), true);
        assertEquals(wild.match(matchedPatterns, "xxx", pattern), false);

        pattern = wild.compilePattern("*_*");
        assertEquals(wild.match(matchedPatterns, "a_a", pattern), true);
        assertEquals(wild.match(matchedPatterns, "a", pattern), false);
    }

    
> Action mapping *x* resolves to * however *xx* works as expected
> ---------------------------------------------------------------
>
>                 Key: WW-3985
>                 URL: https://issues.apache.org/jira/browse/WW-3985
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Dispatch Filter
>    Affects Versions: 2.3.4, 2.3.8
>            Reporter: Ken McWilliams
>
> When using the default pattern matcher "WildcardHelper" the following action mapping
behaves as if it was "*"
>         <action name="**_**">
>             <result>/WEB-INF/content/testmapping.jsp</result>
>         </action>
> That is, the underscore (or any other single character) is ignored and the action will
map as if it "*".
> I thought it was the fault of WildcardHelper so created test cases and they all passed...
>     @Test
>     public void testMatch() {
>         WildcardHelper wild = new WildcardHelper();
>         HashMap<String, String> matchedPatterns = new HashMap<String, String>();
>         int[] pattern = wild.compilePattern("*b*");
>         assertEquals(wild.match(matchedPatterns, "b", pattern), true);
>         assertEquals(wild.match(matchedPatterns, "abc", pattern), true);
>         assertEquals(wild.match(matchedPatterns, "xxx", pattern), false);
>         pattern = wild.compilePattern("*_*");
>         assertEquals(wild.match(matchedPatterns, "a_a", pattern), true);
>         assertEquals(wild.match(matchedPatterns, "a", pattern), false);
>     }

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message