[
https://issues.apache.org/jira/browse/WW-3985?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13580409#comment-13580409
]
Ken McWilliams edited comment on WW-3985 at 2/18/13 4:44 AM:
-------------------------------------------------------------
See discussion here on stack overflow:
http://stackoverflow.com/questions/14913560/struts2-action-works-just-like
which has found the behaviour _is_ intentional. See:
http://struts.apache.org/release/2.2.x/xwork-core/apidocs/com/opensymphony/xwork2/config/impl/AbstractMatcher.html#addPattern(java.lang.String,%20E,%20boolean)
and read the note which explains efforts to preserve backwards compatibility
have created this issue. I think when using wildcards the issue could be
readily encountered and documentation on the wildcards does not currently point
out this pitfall. Disabling the functionality going forward and providing a
backwards compatibility constant to enable the feature would be nice.
was (Author: ken_mcwilliams):
See discussion here on stack overflow:
http://stackoverflow.com/questions/14913560/struts2-action-works-just-like
which has found the behaviour _is_ intentional. See:
http://struts.apache.org/release/2.2.x/xwork-core/apidocs/com/opensymphony/xwork2/config/impl/AbstractMatcher.html#addPattern(java.lang.String,%20E,%20boolean)
and read the note which explains efforts to preserve backwards compatibility
have created this issue. I think when using wildcards the issue could be
readily encountered and documentation on the wildcards does not point out this
pitfall. Disabling the functionality going forward and providing a backwards
compatibility constant to enable the feature would be nice.
> 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
> Fix For: 2.3.11
>
>
> 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 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