[prev in list] [next in list] [prev in thread] [next in thread]
List: httpclient-users
Subject: Re: IllegalArgumentException when URL contains []
From: Philippe Mouawad <philippe.mouawad () gmail ! com>
Date: 2013-02-03 22:21:36
Message-ID: CAH9fUpZbWAKJmcNzVNkVF6U5ub888MnryJagFXrQQwNuexyJag () mail ! gmail ! com
[Download RAW message or body]
Thanks Oleg !
On Sun, Feb 3, 2013 at 11:04 PM, Oleg Kalnichevski <olegk@apache.org> wrote:
> 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 <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
> > >
> > >
> >
> >
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
> For additional commands, e-mail: httpclient-users-help@hc.apache.org
>
>
--
Cordialement.
Philippe Mouawad.
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic