NullPointerException happens when trying to decode HEAD response
----------------------------------------------------------------
Key: ABDERA-259
URL: https://issues.apache.org/jira/browse/ABDERA-259
Project: Abdera
Issue Type: Bug
Affects Versions: 1.0, 0.4.0
Reporter: Tong Xiang Fan
The client code sends HEAD request to HTTP server. The Content-Encoding header
is not null so it tries to decode the response. However httpclient HeadMethod
returns null as response body stream. Hence NullPointerException happens.
java.lang.NullPointerException
at java.util.zip.InflaterInputStream.<init>(InflaterInputStream.java:91)
at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:81)
at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:93)
at
org.apache.abdera.util.CompressionUtil.getDecodingInputStream(CompressionUtil.java:71)
at
org.apache.abdera.protocol.util.EncodingUtil.getDecodingInputStream(EncodingUtil.java:160)
at
org.apache.abdera.protocol.client.CommonsResponse.getInputStream(CommonsResponse.java:156)
at
org.apache.abdera.protocol.client.cache.InMemoryCachedResponse.<init>(InMemoryCachedResponse.java:55)
at
org.apache.abdera.protocol.client.cache.InMemoryCache.createCachedResponse(InMemoryCache.java:44)
at
org.apache.abdera.protocol.client.cache.AbstractCache.update(AbstractCache.java:142)
at
org.apache.abdera.protocol.client.cache.AbstractCache.update(AbstractCache.java:130)
at
org.apache.abdera.protocol.client.AbderaClient.execute(AbderaClient.java:698)
at
org.apache.abdera.protocol.client.AbderaClient.head(AbderaClient.java:167)
at
org.apache.abdera.protocol.client.AbderaClient.head(AbderaClient.java:344)
Sample response:
Date: Tue, 20 Jul 2010 07:53:08 GMT
Server: IBM_HTTP_Server/6.1 Apache/2.0.47 (Win32)
Expires: Thu, 1 Jan 1970 00:00:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Vary: Accept-Encoding
Content-Encoding: gzip
Keep-Alive: timeout=10, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html; charset=UTF-8
Content-Language: en-US
org.apache.abdera.protocol.client.CommonsResponse:
public InputStream getInputStream() throws IOException {
if (in == null) {
String ce = getHeader("Content-Encoding");
in = method.getResponseBodyAsStream(); // returns null if method is HEAD
if (ce != null)
in = EncodingUtil.getDecodingInputStream(in, ce);
in = new AutoReleasingInputStream(method,in);
}
return in;
}
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.