Commit 848127ae authored by dreis2211's avatar dreis2211 Committed by Stephane Nicoll

Avoid recompiling pattern in Handler#canonicalize

See gh-21103
parent 3f96e216
...@@ -49,6 +49,8 @@ public class Handler extends URLStreamHandler { ...@@ -49,6 +49,8 @@ public class Handler extends URLStreamHandler {
private static final String SEPARATOR = "!/"; private static final String SEPARATOR = "!/";
private static final Pattern SEPARATOR_PATTERN = Pattern.compile(SEPARATOR, Pattern.LITERAL);
private static final String CURRENT_DIR = "/./"; private static final String CURRENT_DIR = "/./";
private static final Pattern CURRENT_DIR_PATTERN = Pattern.compile(CURRENT_DIR, Pattern.LITERAL); private static final Pattern CURRENT_DIR_PATTERN = Pattern.compile(CURRENT_DIR, Pattern.LITERAL);
...@@ -285,7 +287,7 @@ public class Handler extends URLStreamHandler { ...@@ -285,7 +287,7 @@ public class Handler extends URLStreamHandler {
} }
private String canonicalize(String path) { private String canonicalize(String path) {
return path.replace(SEPARATOR, "/"); return SEPARATOR_PATTERN.matcher(path).replaceAll("/");
} }
public JarFile getRootJarFileFromUrl(URL url) throws IOException { public JarFile getRootJarFileFromUrl(URL url) throws IOException {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment