Compression filter - trivial bug fix and fix for use with SSL
-------------------------------------------------------------

                 Key: DIRMINA-530
                 URL: https://issues.apache.org/jira/browse/DIRMINA-530
             Project: MINA
          Issue Type: Bug
          Components: Filter
    Affects Versions: 2.0.0-M2
         Environment: N/A?  But Mac OS X Leopard (Java 1.5) does display the 
issue.
            Reporter: Justin SB
             Fix For: 2.0.0-M2


The compression filter has a simple bug, where it uses limit() instead of 
remaining(). Where position != 0, this causes reads to exceed available data:
-        byte[] inBytes = new byte[inBuffer.limit()];
+        byte[] inBytes = new byte[inBuffer.remaining()];
         inBuffer.get(inBytes).flip();
 
Also, when the compression filter is chained with the SSL filter, and SSL 
status notification is enabled, the SSL filter sends state messages through the 
chain.  These are not IoBuffers, but the compression filter treats them as if 
they were:

+    public void messageReceived(NextFilter nextFilter, IoSession session, 
Object message) throws Exception {
+       // Ignore control messages e.g. from SSL filter
+       boolean compress = compressInbound && (message instanceof IoBuffer);
+       
+        if (!compress)  {

Patch file will be attached...

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to