Program: 4208
Project: 4208
Buggy source:
/** 
 * Sets the new ReadObserver. The deepest ChannelReader in the chain first has its source set to the prior reader (assuming it implemented ReadableByteChannel) and a read is notified, in order to read any buffered data. The source is then set to the Socket's channel and interest in reading is turned on.
 */
public final void setReadObserver(final ChannelReadObserver newReader){
  NIODispatcher.instance().getScheduledExecutorService().execute(new Runnable(){
    public void run(){
      ReadObserver oldReader=reader;
      try {
synchronized (LOCK) {
          if (shutdown) {
            newReader.shutdown();
            return;
          }
          reader=newReader;
        }
        ChannelReader lastChannel=newReader;
        while (lastChannel.getReadChannel() instanceof ChannelReader)         lastChannel=(ChannelReader)lastChannel.getReadChannel();
        if (lastChannel instanceof ThrottleListener)         ((ThrottleListener)lastChannel).setAttachment(AbstractNBSocket.this);
        if (oldReader instanceof InterestReadableByteChannel && oldReader != newReader) {
          lastChannel.setReadChannel((InterestReadableByteChannel)oldReader);
          reader.handleRead();
          oldReader.shutdown();
        }
        InterestReadableByteChannel source=getBaseReadChannel();
        lastChannel.setReadChannel(source);
        if (isConnected() && !NIODispatcher.instance().isReadReadyThisIteration(getChannel()))         ;
        reader.handleRead();
        source.interestRead(true);
      }
 catch (      IOException iox) {
        shutdown();
        oldReader.shutdown();
      }
    }
  }
);
}

Fixed version (ground truth):
/** 
 * Sets the new ReadObserver. The deepest ChannelReader in the chain first has its source set to the prior reader (assuming it implemented ReadableByteChannel) and a read is notified, in order to read any buffered data. The source is then set to the Socket's channel and interest in reading is turned on.
 */
public final void setReadObserver(final ChannelReadObserver newReader){
  NIODispatcher.instance().getScheduledExecutorService().execute(new Runnable(){
    public void run(){
      ReadObserver oldReader=reader;
      try {
synchronized (LOCK) {
          if (shutdown) {
            newReader.shutdown();
            return;
          }
          reader=newReader;
        }
        ChannelReader lastChannel=newReader;
        while (lastChannel.getReadChannel() instanceof ChannelReader)         lastChannel=(ChannelReader)lastChannel.getReadChannel();
        if (lastChannel instanceof ThrottleListener)         ((ThrottleListener)lastChannel).setAttachment(AbstractNBSocket.this);
        if (oldReader instanceof InterestReadableByteChannel && oldReader != newReader) {
          lastChannel.setReadChannel((InterestReadableByteChannel)oldReader);
          reader.handleRead();
          oldReader.shutdown();
        }
        InterestReadableByteChannel source=getBaseReadChannel();
        lastChannel.setReadChannel(source);
        if (isConnected() && !NIODispatcher.instance().isReadReadyThisIteration(getChannel()))         reader.handleRead();
        source.interestRead(true);
      }
 catch (      IOException iox) {
        shutdown();
        oldReader.shutdown();
      }
    }
  }
);
}