I don't know the answer to your question but I would point out that
according to the Java: the argument is "the path, may contain URI
template parameters."
Perhaps you can escape the braces using percent/URL encoding? Or perhaps
a double slash?
I think the Javadoc should discuss how to escape braces, so I suggest a
issue to that effect.
Gili
On 20/08/2014 2:08 PM, Gabriel Soto wrote:
> I'm trying to perform some fuzz testing by sending requests to a
> server with malformed URIs.
>
> The following minimal code worked well on Jersey 2.3.1:
>
> ClientBuilder.newClient()
> .target(UriBuilder.fromUri("http://localhost"))
> .path("test{}")
> .request();
>
> We just updated to 2.11.0 and the same code produces the following error:
>
> java.lang.IllegalStateException: Illegal character "}" at position 5
> is not allowed as a start of a name in a path template "test{}".
> at
> org.glassfish.jersey.client.JerseyWebTarget.getUri(JerseyWebTarget.java:136)
> at
> org.glassfish.jersey.client.JerseyWebTarget.request(JerseyWebTarget.java:216)
> at
> org.glassfish.jersey.client.JerseyWebTarget.request(JerseyWebTarget.java:59)
> (...)
> Caused by: java.lang.IllegalArgumentException: Illegal character "}"
> at position 5 is not allowed as a start of a name in a path template
> "test{}".
> at
> org.glassfish.jersey.uri.internal.UriTemplateParser.parseName(UriTemplateParser.java:328)
> at
> org.glassfish.jersey.uri.internal.UriTemplateParser.parse(UriTemplateParser.java:251)
> at
> org.glassfish.jersey.uri.internal.UriTemplateParser.<init>(UriTemplateParser.java:110)
> at
> org.glassfish.jersey.uri.UriTemplate.createUriComponent(UriTemplate.java:1001)
> at
> org.glassfish.jersey.uri.UriTemplate.createURIWithStringValues(UriTemplate.java:961)
> at
> org.glassfish.jersey.uri.UriTemplate.createURIWithStringValues(UriTemplate.java:906)
> at
> org.glassfish.jersey.uri.UriTemplate.createURI(UriTemplate.java:871)
> at
> org.glassfish.jersey.uri.internal.JerseyUriBuilder._build(JerseyUriBuilder.java:893)
> at
> org.glassfish.jersey.uri.internal.JerseyUriBuilder.build(JerseyUriBuilder.java:810)
> at
> org.glassfish.jersey.client.JerseyWebTarget.getUri(JerseyWebTarget.java:134)
> (...)
>
> I'm trying to understand if this is related to
> https://java.net/jira/browse/JERSEY-2525
> It certainly doesn't look fixed in this version.
>
> Any ideas?
>
> Thanks,
> Gabriel