Skip to content

Commit

Permalink
Cache the value earlier. Followup to r1809684
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@1809711 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
Konstantin Kolinko committed Sep 26, 2017
1 parent e650cf1 commit 31e9950
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,12 @@ protected final File file(String name, boolean mustExist) {


private boolean isInvalidWindowsFilename(String name) {
if (name.length() == 0) {
final int len = name.length();
if (len == 0) {
return false;
}
// This consistently ~10 times faster than the equivalent regular
// expression irrespective of input length.
final int len = name.length();
for (int i = 0; i < len; i++) {
char c = name.charAt(i);
if (c == '\"' || c == '<' || c == '>') {
Expand Down

0 comments on commit 31e9950

Please sign in to comment.