Skip to content

Commit

Permalink
Extracted pattern to final attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
gastaldi committed Jan 30, 2017
1 parent fc70d31 commit 8117ca8
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
public class ResourcePathResolver
{
private static final Pattern WILDCARDS_PATTERN = Pattern.compile(".*(\\?|\\*)+.*");
private static final Pattern WINDOWS_DRIVE_PATTERN = Pattern.compile("^[a-zA-Z]{1,1}:(/|\\\\).*");

private int cursor;
private final int length;

Expand Down Expand Up @@ -103,7 +105,7 @@ else if (path.startsWith("~"))
}
}
// for windows, support drive letter prefixes here.
else if (isWindows && path.matches("^[a-zA-Z]{1,1}:(/|\\\\).*"))
else if (isWindows && WINDOWS_DRIVE_PATTERN.matcher(path).matches())
{
int idx = path.lastIndexOf(slashChar) + 1;
r = factory.create(DirectoryResource.class, new File(path.substring(0, idx)).getAbsoluteFile());
Expand Down

0 comments on commit 8117ca8

Please sign in to comment.