Skip to content

Commit

Permalink
RESTEASY-1117 UriBuilder.fromUri does not accept colons in relative p…
Browse files Browse the repository at this point in the history
…aths
  • Loading branch information
pbielicki committed Oct 23, 2014
1 parent 00f545a commit f08cf40
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
Expand Up @@ -174,7 +174,8 @@ protected UriBuilder parseHierarchicalUri(String uriTemplate, Matcher match)
if (match.group(5) != null)
{
String group = match.group(5);
if (!scheme && !"".equals(group) && !group.startsWith("/") && group.indexOf(':') > -1) throw new IllegalArgumentException("Illegal uri template: " + uriTemplate);
if (!scheme && !"".equals(group) && !group.startsWith("/") && group.indexOf(':') > -1 &&
group.indexOf('/') > -1 && group.indexOf(':') < group.indexOf('/')) throw new IllegalArgumentException("Illegal uri template: " + uriTemplate);
if (!"".equals(group)) replacePath(group);
}
if (match.group(7) != null) replaceQuery(match.group(7));
Expand Down
@@ -0,0 +1,22 @@
package org.jboss.resteasy.specimpl;

import static org.junit.Assert.assertSame;

import org.junit.Test;

public class ResteasyUriBuilderTest {

@Test
public void testParseHierarchicalUri() {
ResteasyUriBuilder builder = new ResteasyUriBuilder();
assertSame(builder, builder.uri("foo/bar:id"));
builder = new ResteasyUriBuilder();
assertSame(builder, builder.uri("/bar:id"));
builder = new ResteasyUriBuilder();
assertSame(builder, builder.uri("foo:bar/bar:id"));
builder = new ResteasyUriBuilder();
assertSame(builder, builder.uri("foo:/bar"));
builder = new ResteasyUriBuilder();
assertSame(builder, builder.uri("foo:bar"));
}
}

0 comments on commit f08cf40

Please sign in to comment.