2004-11-18 Jeroen Frijters <jeroen@frijters.net>
* java/net/URLStreamHandler.java (parseURL): Fixed file path canonicalisation. From-SVN: r90880
This commit is contained in:
parent
c521478a73
commit
6e5b508490
2 changed files with 8 additions and 17 deletions
|
@ -214,23 +214,9 @@ public abstract class URLStreamHandler
|
|||
file = (file.substring(0, lastSlash)
|
||||
+ '/' + spec.substring(start, end));
|
||||
|
||||
if (url.getProtocol().equals("file"))
|
||||
{
|
||||
// For "file" URLs constructed relative to a context, we
|
||||
// need to canonicalise the file path.
|
||||
try
|
||||
{
|
||||
boolean endsWithSlash = file.charAt(file.length() - 1) == '/';
|
||||
file = new File(file).getCanonicalPath();
|
||||
file = file.replace(separator, '/');
|
||||
if (endsWithSlash && file.charAt(file.length() - 1) != '/')
|
||||
file += '/';
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
// Do nothing.
|
||||
}
|
||||
}
|
||||
// For URLs constructed relative to a context, we
|
||||
// need to canonicalise the file path.
|
||||
file = canonicalizeFilename(file);
|
||||
|
||||
ref = null;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue