summaryrefslogtreecommitdiff
path: root/libjava/classpath/java/net
diff options
context:
space:
mode:
authortromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2008-01-21 20:08:38 +0000
committertromey <tromey@138bc75d-0d04-0410-961f-82ee72b054a4>2008-01-21 20:08:38 +0000
commit77b5c57323b2aa589ffab36eaca7bd1886976141 (patch)
treeca7c99d5b15a1c34e9dd56c8cf949b30f65c4b65 /libjava/classpath/java/net
parente1361bdf5da2fab397496f250ba344fed3d0988e (diff)
downloadgcc-77b5c57323b2aa589ffab36eaca7bd1886976141.tar.gz
2008-01-21 Luciano Chavez <lnx1138@us.ibm.com>
PR libgcj/34369: * java/net/URI.java (relativize): Check initial segment for trailing "/". git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@131701 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/classpath/java/net')
-rw-r--r--libjava/classpath/java/net/URI.java14
1 files changed, 10 insertions, 4 deletions
diff --git a/libjava/classpath/java/net/URI.java b/libjava/classpath/java/net/URI.java
index 43b10fc4195..4bf4db9856c 100644
--- a/libjava/classpath/java/net/URI.java
+++ b/libjava/classpath/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)