Program: 150291
Project: 150291
Buggy source:
public void poll(){
  final CountDownLatch latch=new CountDownLatch(streams.size());
  for (  final KafkaStream<Message> stream : streams) {
    workers.add(executor.submit(new Callable<Void>(){
      @Override public Void call(){
        try {
          for (          MessageAndMetadata<Message> mam : stream) {
            BagheeraMessage bmsg=BagheeraMessage.parseFrom(ByteString.copyFrom(mam.message().payload()));
            KeyValueSink sink=sinkFactory.getSink(bmsg.getNamespace());
            if (sink == null) {
              LOG.error("String_Node_Str" + bmsg.getNamespace());
              break;
            }
            if (bmsg.getOperation() == Operation.CREATE_UPDATE && bmsg.hasId() && bmsg.hasPayload()) {
              if (validationPipeline == null || validationPipeline.isValid(bmsg.getPayload().toByteArray())) {
                if (bmsg.hasTimestamp()) {
                  sink.store(bmsg.getId(),bmsg.getPayload().toByteArray(),bmsg.getTimestamp());
                }
 else {
                  sink.store(bmsg.getId(),bmsg.getPayload().toByteArray());
                }
              }
 else {
                LOG.warn("String_Node_Str" + bmsg.getNamespace());
              }
            }
 else             if (bmsg.getOperation() == Operation.DELETE && bmsg.hasId()) {
              sink.delete(bmsg.getId());
            }
            consumed.mark();
          }
        }
 catch (        InvalidProtocolBufferException e) {
          LOG.error("String_Node_Str",e);
        }
catch (        UnsupportedEncodingException e) {
          LOG.error("String_Node_Str",e);
        }
catch (        IOException e) {
          LOG.error("String_Node_Str",e);
        }
 finally {
          latch.countDown();
        }
        return null;
      }
    }
));
  }
  try {
    while (true) {
      latch.await(10,TimeUnit.SECONDS);
      if (latch.getCount() != streams.size()) {
        break;
      }
    }
  }
 catch (  InterruptedException e) {
    LOG.info("String_Node_Str",e);
  }
  for (  Future<Void> worker : workers) {
    try {
      if (worker.isDone() && !worker.isCancelled()) {
        worker.get(1,TimeUnit.SECONDS);
      }
    }
 catch (    InterruptedException e) {
      LOG.error("String_Node_Str",e);
    }
catch (    ExecutionException e) {
      LOG.error("String_Node_Str",e);
    }
catch (    TimeoutException e) {
      LOG.error("String_Node_Str",e);
    }
catch (    CancellationException e) {
      LOG.error("String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
public void poll(){
  final CountDownLatch latch=new CountDownLatch(streams.size());
  for (  final KafkaStream<Message> stream : streams) {
    workers.add(executor.submit(new Callable<Void>(){
      @Override public Void call(){
        try {
          for (          MessageAndMetadata<Message> mam : stream) {
            BagheeraMessage bmsg=BagheeraMessage.parseFrom(ByteString.copyFrom(mam.message().payload()));
            KeyValueSink sink=sinkFactory.getSink(bmsg.getNamespace());
            if (sink == null) {
              LOG.error("String_Node_Str" + bmsg.getNamespace());
              break;
            }
            if (bmsg.getOperation() == Operation.CREATE_UPDATE && bmsg.hasId() && bmsg.hasPayload()) {
              if (validationPipeline == null || validationPipeline.isValid(bmsg.getPayload().toByteArray())) {
                if (bmsg.hasTimestamp()) {
                  sink.store(bmsg.getId(),bmsg.getPayload().toByteArray(),bmsg.getTimestamp());
                }
 else {
                  sink.store(bmsg.getId(),bmsg.getPayload().toByteArray());
                }
              }
 else {
                invalidMessageMeter.mark();
                LOG.warn("String_Node_Str" + bmsg.getNamespace());
              }
            }
 else             if (bmsg.getOperation() == Operation.DELETE && bmsg.hasId()) {
              sink.delete(bmsg.getId());
            }
            consumed.mark();
          }
        }
 catch (        InvalidProtocolBufferException e) {
          LOG.error("String_Node_Str",e);
        }
catch (        UnsupportedEncodingException e) {
          LOG.error("String_Node_Str",e);
        }
catch (        IOException e) {
          LOG.error("String_Node_Str",e);
        }
 finally {
          latch.countDown();
        }
        return null;
      }
    }
));
  }
  try {
    while (true) {
      latch.await(10,TimeUnit.SECONDS);
      if (latch.getCount() != streams.size()) {
        break;
      }
    }
  }
 catch (  InterruptedException e) {
    LOG.info("String_Node_Str",e);
  }
  for (  Future<Void> worker : workers) {
    try {
      if (worker.isDone() && !worker.isCancelled()) {
        worker.get(1,TimeUnit.SECONDS);
      }
    }
 catch (    InterruptedException e) {
      LOG.error("String_Node_Str",e);
    }
catch (    ExecutionException e) {
      LOG.error("String_Node_Str",e);
    }
catch (    TimeoutException e) {
      LOG.error("String_Node_Str",e);
    }
catch (    CancellationException e) {
      LOG.error("String_Node_Str",e);
    }
  }
}