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: [email protected]
Reporter: [email protected]
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: [email protected]
For additional commands, e-mail: [email protected]