Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-21695

IllegalStateException: WRITER masks original exception

XMLWordPrintable

      A RuntimeException is thrown inside HttpResponseRenderer. Rather than printing this stack trace to the log, I get

      [ERROR] /jenkins/$stapler/bound/db022930-dbbe-4ded-8c68-8690f97920f3/stuff
      java.lang.IllegalStateException: WRITER
      	at org.mortbay.jetty.Response.getOutputStream(Response.java:531)
      	at javax.servlet.ServletResponseWrapper.getOutputStream(ServletResponseWrapper.java:112)
      	at org.kohsuke.stapler.compression.CompressionServletResponse.activateCompressionIfNecessary(CompressionServletResponse.java:44)
      	at org.kohsuke.stapler.compression.CompressionServletResponse.setHeader(CompressionServletResponse.java:31)
      	at javax.servlet.http.HttpServletResponseWrapper.setHeader(HttpServletResponseWrapper.java:160)
      	at org.kohsuke.stapler.ResponseImpl.getCompressedOutputStream(ResponseImpl.java:278)
      	at org.kohsuke.stapler.jelly.DefaultScriptInvoker.createOutputStream(DefaultScriptInvoker.java:88)
      	at org.kohsuke.stapler.jelly.DefaultScriptInvoker.createXMLOutput(DefaultScriptInvoker.java:68)
      	at org.kohsuke.stapler.jelly.DefaultScriptInvoker.invokeScript(DefaultScriptInvoker.java:51)
      	at org.kohsuke.stapler.jelly.JellyFacet$1.dispatch(JellyFacet.java:95)
      	at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:728)
      	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:858)
      	at org.kohsuke.stapler.Stapler.invoke(Stapler.java:631)
      	at hudson.init.impl.InstallUncaughtExceptionHandler$1.reportException(InstallUncaughtExceptionHandler.java:27)
      	at org.kohsuke.stapler.compression.CompressionFilter.reportException(CompressionFilter.java:63)
      	at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:58)
      	at ...
      

      which is not exactly helpful. It seems that rsp.getWriter() has already been called, and Jetty correctly rejects the attempt to call rsp.setHeader("Content-Encoding","gzip").

            jglick Jesse Glick
            jglick Jesse Glick
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: