Uploaded image for project: 'Struts 2'
  1. Struts 2
  2. WW-3985

Action mapping *x* resolves to * however *xx* works as expected

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Not A Problem
    • 2.3.4, 2.3.8
    • None
    • Dispatch Filter
    • None

    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 "*".

      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);
          }
      

      Attachments

        Activity

          People

            Unassigned Unassigned
            ken_mcwilliams Ken McWilliams
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: