Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8274276: Cache normalizedBase URL in URLClassPath.FileLoader #5677

wants to merge 2 commits into from
Changes from 1 commit
File filter

Filter by extension

Filter by extension

Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -1193,7 +1193,8 @@ static boolean isRelative(String child) {
private static class FileLoader extends Loader {
/* Canonicalized File */
private File dir;
private final File dir;
private final URL normalizedBase;

* Creates a new FileLoader for the specified URL with a file protocol.
@@ -1203,6 +1204,7 @@ private FileLoader(URL url) throws IOException {
String path = url.getFile().replace('/', File.separatorChar);
path = ParseUtil.decode(path);
dir = (new File(path)).getCanonicalFile();
normalizedBase = new URL(getBaseURL(), ".");

@@ -1221,7 +1223,6 @@ URL findResource(final String name, boolean check) {
Resource getResource(final String name, boolean check) {
final URL url;
try {
URL normalizedBase = new URL(getBaseURL(), ".");
url = new URL(getBaseURL(), ParseUtil.encodePath(name, false));

if (url.getFile().startsWith(normalizedBase.getFile()) == false) {