You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by Mi...@t-systems.com on 2012/05/25 14:52:07 UTC

java.lang.NullPointerException at org.apache.http.entity.StringEntity.(StringEntity.java:70

Hi all,

I receive a NullPointerException when I'm doing this:

HttpPost method = new HttpPost(someUri);
ContentType ct = ContentType.create("text/xml");
StringEntity entity = new StringEntity(someString, ct);
method.setEntity(entity);

The javadoc says that parameter charset is optional for ContentType but it seems not for StringEntity.
I have the requirement to send a http post with content-type: text/xml in the http header but without a charset. Do I create the HttpPost in a wrong manner or does the requirement make no sense or is it a bug?

Kind regards,

Michael
---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Re: AW: java.lang.NullPointerException at org.apache.http.entity.StringEntity.(StringEntity.java:70

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Wed, 2012-05-30 at 14:52 +0200, Michael.Fankanowsky@t-systems.com
wrote:
> Hi Oleg,
> 
> can I obtain a binary for 4.2.1-SNAPSHOT from somewhere? Do you know when the next stable version will be published?
> 

You can build it from source

http://svn.apache.org/repos/asf/httpcomponents/httpcore/trunk/

There are currently no issues severe enough to warrant an emergency
release. Usually we try a new version every 3 to 4 months.

Oleg

> Kind regards,
> 
> Michael 
> 
> -----Ursprüngliche Nachricht-----
> Von: Oleg Kalnichevski [mailto:olegk@apache.org] 
> Gesendet: Freitag, 25. Mai 2012 15:47
> An: HttpClient User Discussion
> Betreff: Re: java.lang.NullPointerException at org.apache.http.entity.StringEntity.<init>(StringEntity.java:70
> 
> On Fri, 2012-05-25 at 14:52 +0200, Michael.Fankanowsky@t-systems.com
> wrote:
> > Hi all,
> > 
> > I receive a NullPointerException when I'm doing this:
> > 
> > HttpPost method = new HttpPost(someUri); ContentType ct = 
> > ContentType.create("text/xml"); StringEntity entity = new 
> > StringEntity(someString, ct); method.setEntity(entity);
> > 
> > The javadoc says that parameter charset is optional for ContentType but it seems not for StringEntity.
> > I have the requirement to send a http post with content-type: text/xml in the http header but without a charset. Do I create the HttpPost in a wrong manner or does the requirement make no sense or is it a bug?
> > 
> > Kind regards,
> > 
> > Michael
> 
> This is a known regression. Please either upgrade HttpCore to the latest snapshot (4.2.1-SNAPSHOT) or use an explicit charset parameter for now.
>  
> 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
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


AW: java.lang.NullPointerException at org.apache.http.entity.StringEntity.(StringEntity.java:70

Posted by Mi...@t-systems.com.
Hi Oleg,

can I obtain a binary for 4.2.1-SNAPSHOT from somewhere? Do you know when the next stable version will be published?

Kind regards,

Michael 

-----Ursprüngliche Nachricht-----
Von: Oleg Kalnichevski [mailto:olegk@apache.org] 
Gesendet: Freitag, 25. Mai 2012 15:47
An: HttpClient User Discussion
Betreff: Re: java.lang.NullPointerException at org.apache.http.entity.StringEntity.<init>(StringEntity.java:70

On Fri, 2012-05-25 at 14:52 +0200, Michael.Fankanowsky@t-systems.com
wrote:
> Hi all,
> 
> I receive a NullPointerException when I'm doing this:
> 
> HttpPost method = new HttpPost(someUri); ContentType ct = 
> ContentType.create("text/xml"); StringEntity entity = new 
> StringEntity(someString, ct); method.setEntity(entity);
> 
> The javadoc says that parameter charset is optional for ContentType but it seems not for StringEntity.
> I have the requirement to send a http post with content-type: text/xml in the http header but without a charset. Do I create the HttpPost in a wrong manner or does the requirement make no sense or is it a bug?
> 
> Kind regards,
> 
> Michael

This is a known regression. Please either upgrade HttpCore to the latest snapshot (4.2.1-SNAPSHOT) or use an explicit charset parameter for now.
 
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


Re: java.lang.NullPointerException at org.apache.http.entity.StringEntity.(StringEntity.java:70

Posted by Oleg Kalnichevski <ol...@apache.org>.
On Fri, 2012-05-25 at 14:52 +0200, Michael.Fankanowsky@t-systems.com
wrote:
> Hi all,
> 
> I receive a NullPointerException when I'm doing this:
> 
> HttpPost method = new HttpPost(someUri);
> ContentType ct = ContentType.create("text/xml");
> StringEntity entity = new StringEntity(someString, ct);
> method.setEntity(entity);
> 
> The javadoc says that parameter charset is optional for ContentType but it seems not for StringEntity.
> I have the requirement to send a http post with content-type: text/xml in the http header but without a charset. Do I create the HttpPost in a wrong manner or does the requirement make no sense or is it a bug?
> 
> Kind regards,
> 
> Michael

This is a known regression. Please either upgrade HttpCore to the latest
snapshot (4.2.1-SNAPSHOT) or use an explicit charset parameter for now.
 
Oleg


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org