diff options
author | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-09-12 01:08:18 +0000 |
---|---|---|
committer | tromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-09-12 01:08:18 +0000 |
commit | 7c5c57d2f73b5776b88f94ce76c04a1125ecef32 (patch) | |
tree | cc393aee173f98e9c7405d011a5edcfacc64ebb6 /libjava | |
parent | 4779f708f3cc2c46be0a530fcb0188d4b55d8496 (diff) | |
download | ppe42-gcc-7c5c57d2f73b5776b88f94ce76c04a1125ecef32.tar.gz ppe42-gcc-7c5c57d2f73b5776b88f94ce76c04a1125ecef32.zip |
* 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 "/".
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@71327 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava')
-rw-r--r-- | libjava/ChangeLog | 7 | ||||
-rw-r--r-- | libjava/java/io/natFilePosix.cc | 5 | ||||
-rw-r--r-- | libjava/java/net/URLStreamHandler.java | 4 |
3 files changed, 14 insertions, 2 deletions
diff --git a/libjava/ChangeLog b/libjava/ChangeLog index de054fde953..6dbfa3c2fc2 100644 --- a/libjava/ChangeLog +++ b/libjava/ChangeLog @@ -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. diff --git a/libjava/java/io/natFilePosix.cc b/libjava/java/io/natFilePosix.cc index a1eb1c74b80..580b5955ac0 100644 --- a/libjava/java/io/natFilePosix.cc +++ b/libjava/java/io/natFilePosix.cc @@ -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 diff --git a/libjava/java/net/URLStreamHandler.java b/libjava/java/net/URLStreamHandler.java index 93a8ab27814..61b466cce6d 100644 --- a/libjava/java/net/URLStreamHandler.java +++ b/libjava/java/net/URLStreamHandler.java @@ -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) { |