tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 56801] New: Avoid duplicated String to CharArray conversion in the loop of Matcher#matchName
Date Fri, 01 Aug 2014 02:31:24 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=56801

            Bug ID: 56801
           Summary: Avoid duplicated String to CharArray conversion in the
                    loop of Matcher#matchName
           Product: Tomcat 7
           Version: trunk
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: xshao@ebay.com

Created attachment 31865
  --> https://issues.apache.org/bugzilla/attachment.cgi?id=31865&action=edit
Patch for Matcher

The loop in matchName,

    public static boolean matchName(Set<String> patternSet, String fileName) {
        for (String pattern: patternSet) {
            if (match(pattern, fileName, true)) {
                return true;
            }
        }
        return false;
    }


Optimized,

    public static boolean matchName(Set<String> patternSet, String fileName) {
        char[] charArray = fileName.toCharArray();
        for (String pattern: patternSet) {
            if (match(pattern, charArray, true)) {
                return true;
            }
        }
        return false;
    }

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message