summaryrefslogtreecommitdiffstats
path: root/libjava
diff options
context:
space:
mode:
Diffstat (limited to 'libjava')
-rw-r--r--libjava/ChangeLog7
-rw-r--r--libjava/java/io/natFilePosix.cc5
-rw-r--r--libjava/java/net/URLStreamHandler.java4
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)
{
OpenPOWER on IntegriCloud