hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: Exception: charset may not be null or empty
Date Sun, 15 Jan 2006 19:05:10 GMT
Uwe Seimet wrote:
> Hello Oleg,
> 
> 
>>Please post the complete exception stack trace and a wire/context log of 
>>the HTTP session
> 
> 
> This is an excerpt from a debug session, which I think shows that the
> exception is caused by a missing charset in the response header:
> 
> [DEBUG] HttpConnection - Releasing connection back to connection manager.
> [DEBUG] header - >> "GET /imprint.html HTTP/1.1[\r][\n]"
> [DEBUG] HttpMethodBase - Adding Host request header
> [DEBUG] header - >> "User-Agent: Mozilla/5.0 (rv:1.7.8) Gecko/20050620 Firefox/1.0.6[\r][\n]"
> [DEBUG] header - >> "Host: solo.seimet.de[\r][\n]"
> [DEBUG] header - >> "[\r][\n]"
> [DEBUG] header - << "HTTP/1.1 200 OK[\r][\n]"
> [DEBUG] header - << "Date: Sun, 15 Jan 2006 18:01:00 GMT[\r][\n]"
> [DEBUG] header - << "Server: Apache[\r][\n]"
> [DEBUG] header - << "Last-Modified: Sun, 27 Nov 2005 17:54:38 GMT[\r][\n]"
> [DEBUG] header - << "Accept-Ranges: bytes[\r][\n]"
> [DEBUG] header - << "Transfer-Encoding: chunked[\r][\n]"
> [DEBUG] header - << "Content-Type: text/html; charset=ISO-8859-1[\r][\n]"
> [WARN] HttpMethodBase - Going to buffer response body of large or unknown size. Using
getResponseBodyAsStream instead is recommended.
> [DEBUG] HttpMethodBase - Buffering response body
> 
> This is the relevant part of the stack backtrace (httpclient 3.0):
> 
> java.lang.IllegalArgumentException: charset may not be null or empty
>         at org.apache.commons.httpclient.util.EncodingUtil.getString(EncodingUtil.java:159)
>         at org.apache.commons.httpclient.util.EncodingUtil.getString(EncodingUtil.java:186)
>         at org.apache.commons.httpclient.HttpMethodBase.getResponseBodyAsString(HttpMethodBase.java:738)
> 
> Best regards,  Uwe
> 

Uwe,

This is not what I am seeing in the wire log:

[DEBUG] header - -<< "Server: XXL http server V2.60[\r][\n]"
[DEBUG] header - -<< "Content-Type: text/html; charset=[\r][\n]"
[DEBUG] header - -<< "Date: Sun, 15 Jan 2006 18:59:40 GMT[\r][\n]"
[DEBUG] header - -<< "Last-Modified: Fri, 22 Apr 2005 13:01:36 GMT[\r][\n]"
[DEBUG] header - -<< "Accept-Ranges: bytes[\r][\n]"
[DEBUG] header - -<< "Connection: close[\r][\n]"
[DEBUG] header - -<< "Content-Length: 10033[\r][\n]"

The charset is wrong. So, HttpClient is correct in throwing an exception.

Oleg

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


Mime
View raw message