Uploaded image for project: 'Click'
  1. Click
  2. CLK-323

CompressionServletResponseWrapper throws NPE in Jetty

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Blocker
    • Resolution: Fixed
    • 1.4
    • 1.4
    • None
    • None
    • Jetty 5.1.4, Websphere 6

    Description

      Ricardo reported a compression issue while using PerformanceFilter in Jetty 5.1.4.

      Here is the stack trace:

      java.lang.NullPointerException
      at net.sf.click.extras.filter.CompressionServletResponseWrapper.flushBuffer(CompressionServletResponseWrapper.java:149)
      at org.mortbay.jetty.servlet.Default.passConditionalHeaders(Default.java:501)
      at org.mortbay.jetty.servlet.Default.handleGet(Default.java:327)
      at org.mortbay.jetty.servlet.Default.service(Default.java:232)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
      at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:427)
      at org.mortbay.jetty.servlet.WebApplicationHandler$CachedChain.doFilter(WebApplicationHandler.java:832)
      at net.sf.click.extras.filter.PerformanceFilter.doFilter(PerformanceFilter.java:378)

      Source info:

      #1 http://www.servlets.com/archive/servlet/ReadMsg?msgId=498901&listName=jetty-support
      #2 http://www.servlets.com/archive/servlet/ReadMsg?msgId=196252&listName=tomcat-dev

      it sounds like the problem comes from a null stream when the serving a 304 (not modified) response.

      The following change needs to be applied to CompressionServletResponseWrapper#flushBuffer:

      public void flushBuffer() throws IOException {
      if (writer != null)

      { writer.flush(); }

      else if (stream != null)

      { ((CompressionResponseStream) stream).flush(); }

      }

      We should also flush the writer according to #2

      Attachments

        Activity

          People

            medgar Malcolm Edgar
            sabob Bob Schellink
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: