On Sun, 2013-02-03 at 22:47 +0100, Philippe Mouawad wrote:
> Hello Oleg,
> Thanks for answer. Is there some helper class in HttpClient for this ?
> 

You can use URIBuilder in order to construct a well formed URI.

Oleg

> Regards
> Philippe
> On Sun, Feb 3, 2013 at 10:33 PM, Oleg Kalnichevski <[email protected]> wrote:
> 
> > On Sun, 2013-02-03 at 22:24 +0100, Philippe Mouawad wrote:
> > > Hello,
> > > Calling  httpRequest = new HttpGet(uri); with uri equal to:
> > >
> > >    - http://example.com/path/to/file[3].html
> > >
> > > generates this exception:
> > > java.lang.IllegalArgumentException
> > >     at java.net.URI.create(URI.java:841)
> > >     at org.apache.http.client.methods.HttpGet.<init>(HttpGet.java:69)
> > >     at
> > >
> > org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:249)
> > >     at
> > >
> > org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:62)
> > >     at
> > >
> > org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1088)
> > >     at
> > >
> > org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1077)
> > >     at
> > >
> > org.apache.jmeter.threads.JMeterThread.process_sampler(JMeterThread.java:428)
> > >     at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:256)
> > >     at java.lang.Thread.run(Thread.java:680)
> > > Caused by: java.net.URISyntaxException: Illegal character in path at
> > index
> > > 31: http://example.com/path/to/file[3].html
> > >     at java.net.URI$Parser.fail(URI.java:2810)
> > >     at java.net.URI$Parser.checkChars(URI.java:2983)
> > >     at java.net.URI$Parser.parseHierarchical(URI.java:3067)
> > >     at java.net.URI$Parser.parse(URI.java:3015)
> > >     at java.net.URI.<init>(URI.java:577)
> > >     at java.net.URI.create(URI.java:839)
> > >     ... 8 more
> > >
> > >
> > > Are we supposed to encode this kind of URLs or is it some bug ?
> > >
> > > Regards
> > > Philippe
> >
> > Philippe
> >
> > The URI in question contains invalid characters. Both '[' and ']' are
> > illegal for URIs and need to be escaped.
> >
> > Oleg
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [email protected]
> > For additional commands, e-mail: [email protected]
> >
> >
> 
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to