On 05/07/2011 18:23, Konstantin Kolinko wrote:
> 2011/7/5  <ma...@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-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to