Program: 7669
Project: 7669
Buggy source:
@Override public void getLogPrev(final LoggingContext loggingContext,final long fromOffset,final int maxEvents,final Filter filter,final Callback callback){
  executor.submit(new Runnable(){
    @Override public void run(){
      int partition=partitioner.partition(loggingContext.getLogPartition(),numPartitions);
      callback.init();
      KafkaConsumer kafkaConsumer=new KafkaConsumer(seedBrokers,topic,partition,kafkaTailFetchTimeoutMs);
      try {
        Filter logFilter=new AndFilter(ImmutableList.of(LoggingContextHelper.createFilter(loggingContext),filter));
        long latestOffset=kafkaConsumer.fetchOffset(KafkaConsumer.Offset.LATEST);
        long earliestOffset=kafkaConsumer.fetchOffset(KafkaConsumer.Offset.EARLIEST);
        long startOffset=fromOffset - maxEvents;
        long stopOffset=fromOffset;
        int adjMaxEvents=maxEvents;
        if (fromOffset < 0) {
          startOffset=latestOffset - maxEvents;
          stopOffset=latestOffset;
        }
        if (startOffset < earliestOffset) {
          startOffset=earliestOffset;
          adjMaxEvents=(int)(fromOffset - startOffset);
        }
        if (startOffset >= stopOffset || startOffset >= latestOffset) {
          return;
        }
        int fetchCount=0;
        while (fetchCount == 0) {
          fetchCount=fetchLogEvents(kafkaConsumer,logFilter,startOffset,stopOffset,adjMaxEvents,callback);
          stopOffset=startOffset;
          if (stopOffset <= earliestOffset) {
            break;
          }
          startOffset=startOffset - adjMaxEvents;
          if (startOffset < earliestOffset) {
            startOffset=earliestOffset;
          }
        }
      }
 catch (      Throwable e) {
        LOG.error("String_Node_Str",e);
        throw Throwables.propagate(e);
      }
 finally {
        try {
          try {
            callback.close();
          }
  finally {
            kafkaConsumer.close();
          }
        }
 catch (        IOException e) {
          LOG.error(String.format("String_Node_Str",topic,partition),e);
        }
      }
    }
  }
);
}

Fixed version (ground truth):
@Override public void getLogPrev(final LoggingContext loggingContext,final long fromOffset,final int maxEvents,final Filter filter,final Callback callback){
  executor.submit(new Runnable(){
    @Override public void run(){
      int partition=partitioner.partition(loggingContext.getLogPartition(),numPartitions);
      callback.init();
      KafkaConsumer kafkaConsumer=new KafkaConsumer(seedBrokers,topic,partition,kafkaTailFetchTimeoutMs);
      try {
        Filter logFilter=new AndFilter(ImmutableList.of(LoggingContextHelper.createFilter(loggingContext),filter));
        long latestOffset=kafkaConsumer.fetchOffset(KafkaConsumer.Offset.LATEST);
        long earliestOffset=kafkaConsumer.fetchOffset(KafkaConsumer.Offset.EARLIEST);
        long stopOffset;
        long startOffset;
        if (fromOffset < 0) {
          stopOffset=latestOffset;
        }
 else {
          stopOffset=fromOffset;
        }
        startOffset=stopOffset - maxEvents;
        if (startOffset < earliestOffset) {
          startOffset=earliestOffset;
        }
        if (startOffset >= stopOffset || startOffset >= latestOffset) {
          return;
        }
        int fetchCount=0;
        while (fetchCount == 0) {
          fetchCount=fetchLogEvents(kafkaConsumer,logFilter,startOffset,stopOffset,maxEvents,callback);
          stopOffset=startOffset;
          if (stopOffset <= earliestOffset) {
            break;
          }
          startOffset=stopOffset - maxEvents;
          if (startOffset < earliestOffset) {
            startOffset=earliestOffset;
          }
        }
      }
 catch (      Throwable e) {
        LOG.error("String_Node_Str",e);
        throw Throwables.propagate(e);
      }
 finally {
        try {
          try {
            callback.close();
          }
  finally {
            kafkaConsumer.close();
          }
        }
 catch (        IOException e) {
          LOG.error(String.format("String_Node_Str",topic,partition),e);
        }
      }
    }
  }
);
}