Program: 34267
Project: 34267
Buggy source:
public static void main(String[] args) throws Exception {
  KafkaArgs spraynozzleArgs;
  try {
    spraynozzleArgs=CliFactory.parseArguments(KafkaArgs.class,args);
  }
 catch (  ArgumentValidationException e) {
    System.err.println(e.getMessage());
    return;
  }
  String zk=spraynozzleArgs.getZk();
  ZkClient zkClient=new ZkClient(zk,10000);
  Boolean spraynozzleHA=spraynozzleArgs.getIsHighlyAvailable();
  boolean buffering=spraynozzleArgs.getBuffering();
  String topic=spraynozzleArgs.getTopic();
  final List<String> urls=spraynozzleArgs.getUrls();
  final String cleanedUrl=url.get(0).replaceAll("String_Node_Str","String_Node_Str");
  final int threadCount=spraynozzleArgs.getThreadCount();
  final int partitionCount=spraynozzleArgs.getPartitionCount();
  final String filterClass=spraynozzleArgs.getFilterClass();
  final String filterClasspath=spraynozzleArgs.getFilterClasspath();
  final String filterClassArgs=spraynozzleArgs.getFilterClassArgs();
  final String statsClass=spraynozzleArgs.getStatsClass();
  final String statsClasspath=spraynozzleArgs.getStatsClasspath();
  final String statsClassArgs=spraynozzleArgs.getStatsClassArgs();
  String[] topics=topic.split("String_Node_Str");
  if (topics.length == 1) {
    System.out.println("String_Node_Str" + topic + "String_Node_Str"+ zk+ "String_Node_Str"+ urls);
  }
 else {
    System.out.println("String_Node_Str" + topic + "String_Node_Str"+ zk+ "String_Node_Str"+ urls);
  }
  if (spraynozzleHA) {
    String zkLeaderLatchFolderPath="String_Node_Str" + topics[0] + cleanedUrl;
    System.out.println("String_Node_Str");
    String spraynozzleName="String_Node_Str" + UUID.randomUUID();
    SpraynozzleLeaderLatch curatorClient=new SpraynozzleLeaderLatch(zk,zkLeaderLatchFolderPath,spraynozzleName);
    curatorClient.start();
    curatorClient.blockUntilisLeader();
    System.out.println("String_Node_Str" + spraynozzleName + "String_Node_Str");
  }
  if (!buffering) {
    clearZkPath(zkClient,"String_Node_Str" + topics[0] + cleanedUrls);
  }
  Properties kafkaProps=new Properties();
  kafkaProps.put("String_Node_Str",zk);
  kafkaProps.put("String_Node_Str","String_Node_Str");
  kafkaProps.put("String_Node_Str","String_Node_Str" + topics[0] + cleanedUrl);
  kafkaProps.put("String_Node_Str","String_Node_Str");
  kafkaProps.put("String_Node_Str",String.valueOf(2 * 1024 * 1024));
  ConsumerConfig consumerConfig=new ConsumerConfig(kafkaProps);
  ConsumerConnector consumerConnector=Consumer.createJavaConsumerConnector(consumerConfig);
  HashMap<String,Integer> topicParallelism=new HashMap<String,Integer>();
  for (int i=0; i < topics.length; i++) {
    topicParallelism.put(topics[i],partitionCount);
  }
  Map<String,List<KafkaStream<Message>>> topicMessageStreams=consumerConnector.createMessageStreams(topicParallelism);
  ArrayList<List<KafkaStream<Message>>> streams=new ArrayList<List<KafkaStream<Message>>>();
  for (int i=0; i < topics.length; i++) {
    List<KafkaStream<Message>> stream=topicMessageStreams.get(topics[i]);
    streams.add(stream);
  }
  ExecutorService executor=Executors.newFixedThreadPool(threadCount + (partitionCount * topics.length) + 1);
  final PoolingHttpClientConnectionManager cm=new PoolingHttpClientConnectionManager();
  cm.setMaxTotal(threadCount);
  cm.setDefaultMaxPerRoute(threadCount);
  final ConcurrentLinkedQueue<ByteArrayEntity> queue=new ConcurrentLinkedQueue<ByteArrayEntity>();
  final ConcurrentLinkedQueue<String> logQueue=new ConcurrentLinkedQueue<String>();
  StatsReporter statsReporter=getStatsReporter(statsClasspath,statsClass,statsClassArgs);
  executor.submit(new KafkaLog(logQueue,statsReporter,topic,urls));
  for (  final List<KafkaStream<Message>> streamList : streams) {
    for (    final KafkaStream<Message> stream : streamList) {
      executor.submit(new KafkaReader(queue,stream,logQueue));
    }
  }
  for (int i=0; i < threadCount; i++) {
    KafkaFilter messageFilter=getKafkaFilter(filterClass,filterClasspath,filterClassArgs);
    executor.submit(new KafkaPoster(queue,cm,urls,logQueue,messageFilter));
  }
}

Fixed version (ground truth):
public static void main(String[] args) throws Exception {
  KafkaArgs spraynozzleArgs;
  try {
    spraynozzleArgs=CliFactory.parseArguments(KafkaArgs.class,args);
  }
 catch (  ArgumentValidationException e) {
    System.err.println(e.getMessage());
    return;
  }
  String zk=spraynozzleArgs.getZk();
  ZkClient zkClient=new ZkClient(zk,10000);
  Boolean spraynozzleHA=spraynozzleArgs.getIsHighlyAvailable();
  boolean buffering=spraynozzleArgs.getBuffering();
  String topic=spraynozzleArgs.getTopic();
  final List<String> urls=spraynozzleArgs.getUrls();
  final String cleanedUrl=urls.get(0).replaceAll("String_Node_Str","String_Node_Str");
  final int threadCount=spraynozzleArgs.getThreadCount();
  final int partitionCount=spraynozzleArgs.getPartitionCount();
  final String filterClass=spraynozzleArgs.getFilterClass();
  final String filterClasspath=spraynozzleArgs.getFilterClasspath();
  final String filterClassArgs=spraynozzleArgs.getFilterClassArgs();
  final String statsClass=spraynozzleArgs.getStatsClass();
  final String statsClasspath=spraynozzleArgs.getStatsClasspath();
  final String statsClassArgs=spraynozzleArgs.getStatsClassArgs();
  String[] topics=topic.split("String_Node_Str");
  if (topics.length == 1) {
    System.out.println("String_Node_Str" + topic + "String_Node_Str"+ zk+ "String_Node_Str"+ urls);
  }
 else {
    System.out.println("String_Node_Str" + topic + "String_Node_Str"+ zk+ "String_Node_Str"+ urls);
  }
  if (spraynozzleHA) {
    String zkLeaderLatchFolderPath="String_Node_Str" + topics[0] + cleanedUrl;
    System.out.println("String_Node_Str");
    String spraynozzleName="String_Node_Str" + UUID.randomUUID();
    SpraynozzleLeaderLatch curatorClient=new SpraynozzleLeaderLatch(zk,zkLeaderLatchFolderPath,spraynozzleName);
    curatorClient.start();
    curatorClient.blockUntilisLeader();
    System.out.println("String_Node_Str" + spraynozzleName + "String_Node_Str");
  }
  if (!buffering) {
    clearZkPath(zkClient,"String_Node_Str" + topics[0] + cleanedUrl);
  }
  Properties kafkaProps=new Properties();
  kafkaProps.put("String_Node_Str",zk);
  kafkaProps.put("String_Node_Str","String_Node_Str");
  kafkaProps.put("String_Node_Str","String_Node_Str" + topics[0] + cleanedUrl);
  kafkaProps.put("String_Node_Str","String_Node_Str");
  kafkaProps.put("String_Node_Str",String.valueOf(2 * 1024 * 1024));
  ConsumerConfig consumerConfig=new ConsumerConfig(kafkaProps);
  ConsumerConnector consumerConnector=Consumer.createJavaConsumerConnector(consumerConfig);
  HashMap<String,Integer> topicParallelism=new HashMap<String,Integer>();
  for (int i=0; i < topics.length; i++) {
    topicParallelism.put(topics[i],partitionCount);
  }
  Map<String,List<KafkaStream<Message>>> topicMessageStreams=consumerConnector.createMessageStreams(topicParallelism);
  ArrayList<List<KafkaStream<Message>>> streams=new ArrayList<List<KafkaStream<Message>>>();
  for (int i=0; i < topics.length; i++) {
    List<KafkaStream<Message>> stream=topicMessageStreams.get(topics[i]);
    streams.add(stream);
  }
  ExecutorService executor=Executors.newFixedThreadPool(threadCount + (partitionCount * topics.length) + 1);
  final PoolingHttpClientConnectionManager cm=new PoolingHttpClientConnectionManager();
  cm.setMaxTotal(threadCount);
  cm.setDefaultMaxPerRoute(threadCount);
  final ConcurrentLinkedQueue<ByteArrayEntity> queue=new ConcurrentLinkedQueue<ByteArrayEntity>();
  final ConcurrentLinkedQueue<String> logQueue=new ConcurrentLinkedQueue<String>();
  StatsReporter statsReporter=getStatsReporter(statsClasspath,statsClass,statsClassArgs);
  executor.submit(new KafkaLog(logQueue,statsReporter,topic,urls));
  for (  final List<KafkaStream<Message>> streamList : streams) {
    for (    final KafkaStream<Message> stream : streamList) {
      executor.submit(new KafkaReader(queue,stream,logQueue));
    }
  }
  for (int i=0; i < threadCount; i++) {
    KafkaFilter messageFilter=getKafkaFilter(filterClass,filterClasspath,filterClassArgs);
    executor.submit(new KafkaPoster(queue,cm,urls,logQueue,messageFilter));
  }
}