aboutsummaryrefslogtreecommitdiff
path: root/libjava/java
diff options
context:
space:
mode:
authorMohan Embar <gnustuff@thisiscool.com>2004-07-06 16:27:26 +0000
committerMohan Embar <membar@gcc.gnu.org>2004-07-06 16:27:26 +0000
commitc09bade66238d64dbe68f1333b854b8659aaa547 (patch)
tree5470bbac1f5bdbf5ff02d578049d2e0d497d7c6c /libjava/java
parent88a2ae206ea08e0a86c782cd442a59896d9f6c17 (diff)
downloadgcc-c09bade66238d64dbe68f1333b854b8659aaa547.zip
gcc-c09bade66238d64dbe68f1333b854b8659aaa547.tar.gz
gcc-c09bade66238d64dbe68f1333b854b8659aaa547.tar.bz2
URLStreamHandler.java (parseURL): Canonicalize file portion of URL in addition to spec for file: protocol.
* java/net/URLStreamHandler.java (parseURL): Canonicalize file portion of URL in addition to spec for file: protocol. From-SVN: r84157
Diffstat (limited to 'libjava/java')
-rw-r--r--libjava/java/net/URLStreamHandler.java12
1 files changed, 8 insertions, 4 deletions
diff --git a/libjava/java/net/URLStreamHandler.java b/libjava/java/net/URLStreamHandler.java
index d224ff5..5fef7ea 100644
--- a/libjava/java/net/URLStreamHandler.java
+++ b/libjava/java/net/URLStreamHandler.java
@@ -1,5 +1,5 @@
/* URLStreamHandler.java -- Abstract superclass for all protocol handlers
- Copyright (C) 1998, 1999, 2002, 2003 Free Software Foundation, Inc.
+ Copyright (C) 1998, 1999, 2002, 2003, 2004 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -131,8 +131,12 @@ public abstract class URLStreamHandler
String query = null;
// On Windows we need to change \ to / for file URLs
- if (url.getProtocol().equals("file"))
- spec = spec.replace(File.separatorChar, '/');
+ char separator = File.separatorChar;
+ if (url.getProtocol().equals("file") && separator != '/')
+ {
+ file = file.replace(separator, '/');
+ spec = spec.replace(separator, '/');
+ }
if (spec.regionMatches(start, "//", 0, 2))
{
@@ -216,7 +220,7 @@ public abstract class URLStreamHandler
{
boolean endsWithSlash = file.charAt(file.length() - 1) == '/';
file = new File(file).getCanonicalPath();
- file = file.replace(File.separatorChar, '/');
+ file = file.replace(separator, '/');
if (endsWithSlash && file.charAt(file.length() - 1) != '/')
file += '/';
}