summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2008-01-21 20:09:55 +0000
committerTom Tromey <tromey@redhat.com>2008-01-21 20:09:55 +0000
commitaedbe5c94da87967d8fc3be960c034795bc153aa (patch)
tree0870e8824d71657e5b10dded2e8e3b7ac3a5f7df
parent5166c6047016606dfe6a4382d6118cce47637221 (diff)
downloadclasspath-aedbe5c94da87967d8fc3be960c034795bc153aa.tar.gz
2008-01-21 Luciano Chavez <lnx1138@us.ibm.com>
PR libgcj/34369: * java/net/URI.java (relativize): Check initial segment for trailing "/".
-rw-r--r--ChangeLog6
-rw-r--r--java/net/URI.java14
2 files changed, 16 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index c40808ac6..4f32be94b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-01-21 Luciano Chavez <lnx1138@us.ibm.com>
+
+ PR libgcj/34369:
+ * java/net/URI.java (relativize): Check initial segment for
+ trailing "/".
+
2008-01-14 Andrew John Hughes <gnu_andrew@member.fsf.org>
* m4/acinclude.m4:
diff --git a/java/net/URI.java b/java/net/URI.java
index 43b10fc41..4bf4db985 100644
--- a/java/net/URI.java
+++ b/java/net/URI.java
@@ -1,5 +1,5 @@
/* URI.java -- An URI class
- Copyright (C) 2002, 2004, 2005, 2006 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2004, 2005, 2006, 2008 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -968,12 +968,18 @@ public final class URI
return uri;
if (rawAuthority != null && !(rawAuthority.equals(uri.getRawAuthority())))
return uri;
- if (!(uri.getRawPath().startsWith(rawPath)))
- return uri;
+ String basePath = rawPath;
+ if (!(uri.getRawPath().equals(rawPath)))
+ {
+ if (!(basePath.endsWith("/")))
+ basePath = basePath.concat("/");
+ if (!(uri.getRawPath().startsWith(basePath)))
+ return uri;
+ }
try
{
return new URI(null, null,
- uri.getRawPath().substring(rawPath.length()),
+ uri.getRawPath().substring(basePath.length()),
uri.getRawQuery(), uri.getRawFragment());
}
catch (URISyntaxException e)