look in readLength(). incomingBuffer is set to a newly allocated ByteBuffer.


On 10/21/2010 07:52 AM, Thomas Koch wrote:

inside ClientCnxn.SendThread we have

     final ByteBuffer lenBuffer = ByteBuffer.allocateDirect(4);
     ByteBuffer incomingBuffer = lenBuffer;

So incomingBuffer and lenBuffer do refer to the same object. There are several
other places where lenBuffer is again assigned to incomingBuffer.

Now inside the doIO() method we got

             if (incomingBuffer == lenBuffer) {
             } else if (!initialized) {

incomingBuffer is never assigned anything else then lenBuffer, lenBuffer stays
the same all the time. So as far as my knowledge of java reaches (which may
not be too far) incomingBuffer == lenBuffer _always_ evaluates to true. Isn't
that true?

So effectively we've got dead code in the elseif and else branches, didn't we?

Best regards,

Thomas Koch, http://www.koch.ro

Reply via email to