]> gcc.gnu.org Git - gcc.git/commitdiff
re PR libgcj/34369 (java.net.URI.relativize(URI) method returns incorrect results)
authorLuciano Chavez <lnx1138@us.ibm.com>
Mon, 21 Jan 2008 20:08:38 +0000 (20:08 +0000)
committerTom Tromey <tromey@gcc.gnu.org>
Mon, 21 Jan 2008 20:08:38 +0000 (20:08 +0000)
2008-01-21  Luciano Chavez  <lnx1138@us.ibm.com>

PR libgcj/34369:
* java/net/URI.java (relativize): Check initial segment for
trailing "/".

From-SVN: r131701

libjava/classpath/ChangeLog
libjava/classpath/java/net/URI.java
libjava/classpath/lib/java/net/URI.class

index 4086a236ceaca43e5becee549fa548d3ef2026a1..fbeb438713c5c67afbd2e38289999c61fdd5db94 100644 (file)
@@ -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 "/".
+
 2007-12-05  Thomas Fitzsimmons  <fitzsim@redhat.com>
 
        * gnu/java/awt/peer/gtk/GdkGraphicsEnvironment.java,
index 43b10fc41955c49804890340748a18dd4796c17e..4bf4db9856c0ce3471afd11f0ad7ec6ae207f367 100644 (file)
@@ -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)
index 760c952f19258892bc0fe767563b62074bb0bb86..be72cf438de14831759b0c50618920fea427f958 100644 (file)
Binary files a/libjava/classpath/lib/java/net/URI.class and b/libjava/classpath/lib/java/net/URI.class differ
This page took 0.070242 seconds and 5 git commands to generate.