hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Philippe Mouawad <philippe.moua...@gmail.com>
Subject Re: IllegalArgumentException when URL contains []
Date Sun, 03 Feb 2013 21:47:55 GMT
Hello Oleg,
Thanks for answer. Is there some helper class in HttpClient for this ?

Regards
Philippe
On Sun, Feb 3, 2013 at 10:33 PM, Oleg Kalnichevski <olegk@apache.org> 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: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
>


-- 
Cordialement.
Philippe Mouawad.

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message