mirror of
https://github.com/openjdk/jdk.git
synced 2025-09-18 10:04:42 +02:00
8274276: Cache normalizedBase URL in URLClassPath.FileLoader
Reviewed-by: dfuchs
This commit is contained in:
parent
b36881fa3b
commit
94f5e807c9
1 changed files with 4 additions and 3 deletions
|
@ -597,7 +597,7 @@ public class URLClassPath {
|
|||
/*
|
||||
* Returns the base URL for this Loader.
|
||||
*/
|
||||
URL getBaseURL() {
|
||||
final URL getBaseURL() {
|
||||
return base;
|
||||
}
|
||||
|
||||
|
@ -1199,7 +1199,8 @@ public class URLClassPath {
|
|||
*/
|
||||
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 @@ public class URLClassPath {
|
|||
String path = url.getFile().replace('/', File.separatorChar);
|
||||
path = ParseUtil.decode(path);
|
||||
dir = (new File(path)).getCanonicalFile();
|
||||
normalizedBase = new URL(getBaseURL(), ".");
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1227,7 +1229,6 @@ public class URLClassPath {
|
|||
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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue