Skip to content
Permalink
Browse files
8274276: Cache normalizedBase URL in URLClassPath.FileLoader
Reviewed-by: dfuchs
  • Loading branch information
stsypanov authored and dfuch committed Sep 28, 2021
1 parent b36881f commit 94f5e807c91674cf79e543a66cff1819206a790b
Showing 1 changed file with 4 additions and 3 deletions.
@@ -597,7 +597,7 @@ private static class Loader implements Closeable {
/*
* Returns the base URL for this Loader.
*/
URL getBaseURL() {
final URL getBaseURL() {
return base;
}

@@ -1199,7 +1199,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.
@@ -1209,6 +1210,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(), ".");
}

/*
@@ -1227,7 +1229,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) {

1 comment on commit 94f5e80

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on 94f5e80 Sep 28, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.