URLStreamHandler.java (parseURL): If original file ends with "/", so must canonical result.
* java/net/URLStreamHandler.java (parseURL): If original file ends with "/", so must canonical result. * java/io/natFilePosix.cc (getCanonicalPath): Clean up snafus with nul-termination and finding previous "/". From-SVN: r71327
This commit is contained in:
parent
e4bee82f89
commit
030612a110
3 changed files with 14 additions and 2 deletions
|
@ -1,3 +1,10 @@
|
|||
2003-09-11 Tom Tromey <tromey@redhat.com>
|
||||
|
||||
* java/net/URLStreamHandler.java (parseURL): If original file
|
||||
ends with "/", so must canonical result.
|
||||
* java/io/natFilePosix.cc (getCanonicalPath): Clean up snafus
|
||||
with nul-termination and finding previous "/".
|
||||
|
||||
2003-09-11 Michael Koch <konqueror@gmx.de>
|
||||
|
||||
* acconfig.h: Removed most items.
|
||||
|
|
|
@ -164,7 +164,7 @@ java::io::File::getCanonicalPath (void)
|
|||
// Found ".." component, lop off last part from existing
|
||||
// buffer.
|
||||
--out_idx;
|
||||
while (out_idx > 0 && buf[out_idx] != '/')
|
||||
while (out_idx > 0 && buf2[out_idx] != '/')
|
||||
--out_idx;
|
||||
// Can't go up past "/".
|
||||
if (out_idx == 0)
|
||||
|
@ -179,7 +179,8 @@ java::io::File::getCanonicalPath (void)
|
|||
out_idx += len;
|
||||
}
|
||||
}
|
||||
buf[out_idx] = '\0';
|
||||
|
||||
buf2[out_idx] = '\0';
|
||||
}
|
||||
|
||||
// FIXME: what encoding to assume for file names? This affects many
|
||||
|
|
|
@ -196,7 +196,11 @@ public abstract class URLStreamHandler
|
|||
// need to canonicalise the file path.
|
||||
try
|
||||
{
|
||||
boolean endsWithSlash = file.charAt(file.length() - 1) == '/';
|
||||
file = new File (file).getCanonicalPath ();
|
||||
if (endsWithSlash
|
||||
&& file.charAt(file.length() - 1) != '/')
|
||||
file += '/';
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue