Return-Path: X-Original-To: apmail-cxf-issues-archive@www.apache.org Delivered-To: apmail-cxf-issues-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DCC7BF1BF for ; Mon, 25 Mar 2013 10:11:20 +0000 (UTC) Received: (qmail 28730 invoked by uid 500); 25 Mar 2013 10:11:20 -0000 Delivered-To: apmail-cxf-issues-archive@cxf.apache.org Received: (qmail 28315 invoked by uid 500); 25 Mar 2013 10:11:17 -0000 Mailing-List: contact issues-help@cxf.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cxf.apache.org Delivered-To: mailing list issues@cxf.apache.org Received: (qmail 28080 invoked by uid 99); 25 Mar 2013 10:11:15 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 25 Mar 2013 10:11:15 +0000 Date: Mon, 25 Mar 2013 10:11:15 +0000 (UTC) From: "Stian Soiland-Reyes (JIRA)" To: issues@cxf.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Updated] (CXF-4919) UriInfo.relativize (and HttpUtils.relativize) broken MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/CXF-4919?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Stian Soiland-Reyes updated CXF-4919: ------------------------------------- Description: 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("b/", HttpUtils.relativize(ab, ab)); assertEquals(URI.create("c/d"), HttpUtils.relativize(ab, abcd)); assertEquals(URI.create("../"), HttpUtils.relativize(abcd, ab)); assertEquals("", 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. was: 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("b/", HttpUtils.relativize(ab, ab)); assertEquals(URI.create("c/d"), HttpUtils.relativize(ab, abcd)); assertEquals(URI.create("../"), HttpUtils.relativize(abcd, ab)); assertEquals("", 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() > 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 > > 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("b/", HttpUtils.relativize(ab, ab)); > assertEquals(URI.create("c/d"), HttpUtils.relativize(ab, abcd)); > assertEquals(URI.create("../"), HttpUtils.relativize(abcd, ab)); > assertEquals("", 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. -- 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