You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Sergey Beryozkin (JIRA)" <ji...@apache.org> on 2013/04/30 17:32:15 UTC

[jira] [Resolved] (CXF-4919) UriInfo.relativize (and HttpUtils.relativize) broken

     [ https://issues.apache.org/jira/browse/CXF-4919?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sergey Beryozkin resolved CXF-4919.
-----------------------------------

       Resolution: Fixed
    Fix Version/s: 2.8.0
         Assignee: Sergey Beryozkin

Stian, patch has been applied, many thanks
                
> UriInfo.relativize (and HttpUtils.relativize) broken
> ----------------------------------------------------
>
>                 Key: CXF-4919
>                 URL: https://issues.apache.org/jira/browse/CXF-4919
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.7.3
>            Reporter: Stian Soiland-Reyes
>            Assignee: Sergey Beryozkin
>             Fix For: 2.8.0
>
>
> None of these tests pass:
> {code}
>   
>     @Test
>     public void testRelativize() throws Exception {
>         URI ab = URI.create("http://example.com/a/b/");
>         URI abcd = URI.create("http://example.com/a/b/c/d");
>         assertEquals(URI.create(""), HttpUtils.relativize(ab, ab));
>         assertEquals(URI.create("c/d"), HttpUtils.relativize(ab, abcd));
>         assertEquals(URI.create("../"), HttpUtils.relativize(abcd, ab));
>         assertEquals(URI.create(""), HttpUtils.relativize(abcd, abcd));
>         URI abcd2 = URI.create("http://example.com/a/b/c/d2");
>         assertEquals(URI.create("d2"), HttpUtils.relativize(abcd, abcd2));
>         URI ab2cd = URI.create("http://example.com/a/b2/c/d");
>         assertEquals(URI.create("../../b2/c/d"), HttpUtils.relativize(abcd, ab2cd));
>     }
> {code}
> This affects LinkBuilder.buildRelativize() and UriInfo.relativize()
> The algorithm is basically working by counting elements common by position - this would also fail hard when there are common elements later - but with a different ancestor.
> Javadoc for UriInfo.relativize() also has some testcases that should work.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira