tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Thomas <ma...@apache.org>
Subject Re: svn commit: r1143134 - in /tomcat/trunk: java/org/apache/catalina/tribes/group/interceptors/GzipInterceptor.java test/org/apache/catalina/tribes/group/interceptors/TestGzipInterceptor.java
Date Tue, 05 Jul 2011 17:28:18 GMT
On 05/07/2011 18:23, Konstantin Kolinko wrote:
> 2011/7/5  <markt@apache.org>:
>> Author: markt
>> Date: Tue Jul  5 16:45:38 2011
>> New Revision: 1143134
>>
>> URL: http://svn.apache.org/viewvc?rev=1143134&view=rev
>> Log:
>> Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=51475
>> Handle messages larger than the buffer size. Expand test cases to cover this.
>> Based on a patch by Christian Stöber.
>>
>> Modified:
>>    tomcat/trunk/java/org/apache/catalina/tribes/group/interceptors/GzipInterceptor.java
>>    tomcat/trunk/test/org/apache/catalina/tribes/group/interceptors/TestGzipInterceptor.java
>>
> 
>>     public static byte[] decompress(byte[] data) throws IOException {
>> +        ByteArrayOutputStream bout = new ByteArrayOutputStream();
> 
> The above has initial size of 32 bytes.
> It looks too short but I do not know what typical sizes are in tribes here.

Nor me, but assuming there was a reason for the 2k lets go with that.

> DEFAULT_BUFFER_SIZE will be 2Kb.
> 
> 
>>         ByteArrayInputStream bin = new ByteArrayInputStream(data);
>>         GZIPInputStream gin = new GZIPInputStream(bin);
>>         byte[] tmp = new byte[DEFAULT_BUFFER_SIZE];
>> -        int length = gin.read(tmp);
>> -        byte[] result = new byte[length];
>> -        System.arraycopy(tmp,0,result,0,length);
>> -        return result;
>> +        int length = 0;
> 
> Just
> int  length = gin.read(tmp);
> will save an iteration.

ack.

Cheers.

Mark



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


Mime
View raw message