Uploaded image for project: 'Abdera'
  1. Abdera
  2. ABDERA-259

NullPointerException happens when trying to decode HEAD response

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 0.4.0, 1.0
    • None
    • None

    Description

      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;
      }

      Attachments

        Activity

          People

            ckoppelt Christine Koppelt
            fantongx Tong Xiang Fan
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: