You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2004/02/04 16:53:15 UTC

DO NOT REPLY [Bug 26662] New: - ClassCastException in GzipOutputFilter

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26662>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=26662

ClassCastException in GzipOutputFilter

           Summary: ClassCastException in GzipOutputFilter
           Product: Tomcat 5
           Version: 5.0.18
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Connector:Coyote
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: jakarta@trollingers.com


When using the compression filter included with the coyote connector I get 
ClassCastException's when navigating our site.  It is at line 165 in the 
GzipOutputFilter

159     public long end()
160        throws IOException {
161        if (compressionStream == null) {
162            compressionStream = new GZIPOutputStream(fakeOutputStream);
163        }
164        compressionStream.finish();
165        return ((OutputFilter) buffer).end();
166    }

the buffer being cast into an OutputFilter is not always an OutputFilter as 
show in InternalOutputBuffer line 309 

306    public void addActiveFilter(OutputFilter filter) {
307
308        if (lastActiveFilter == -1) {
309            filter.setBuffer(outputStreamOutputBuffer);
310        } else {
311            for (int i = 0; i <= lastActiveFilter; i++) {
312                if (activeFilters[i] == filter)
313                    return;
314            }
315            filter.setBuffer(activeFilters[lastActiveFilter]);
316        }
317
318        activeFilters[++lastActiveFilter] = filter;
319
320        filter.setResponse(response);
321
322    } 

as you can see if lastActiveFilter = -1 then the buffer is set to 
outputStreamOutputBuffer which is an OutputStreamOutputBuffer which inherits 
from OutputBuffer not OutputFilter so the cast fails.

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