You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "Lukasz Lenart (Jira)" <ji...@apache.org> on 2022/09/15 06:25:00 UTC
[jira] [Closed] (WW-3985) Action mapping *x* resolves to * however *xx* works as expected
[ https://issues.apache.org/jira/browse/WW-3985?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Lukasz Lenart closed WW-3985.
-----------------------------
Resolution: Not A Problem
> 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
> Priority: Major
> Fix For: 6.1.0
>
>
> When using the default pattern matcher "WildcardHelper" the following action mapping behaves as if it was "*"
> {code:xml}
> <action name="*_*">
> <result>/WEB-INF/content/testmapping.jsp</result>
> </action>
> {code}
> That is, the underscore (or any other single character) is ignored and the action will map as "*".
> I thought it was the fault of WildcardHelper so created test cases and they all passed...
> {code:java}
> @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);
> }
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)