Program: 29078
Project: 29078
Buggy source:
/** 
 * Parse single InputStream and return SingleStreamRuntime
 * @param inputStream                 single input stream to be parsed
 * @param executionPlanContext        query to be parsed
 * @param variableExpressionExecutors List to hold VariableExpressionExecutors to update after query parsing
 * @param streamDefinitionMap         Stream Definition Map
 * @param tableDefinitionMap          Table Definition Map
 * @param eventTableMap               EventTable Map
 * @param metaComplexEvent            MetaComplexEvent
 * @param processStreamReceiver       ProcessStreamReceiver
 * @return SingleStreamRuntime
 */
public static SingleStreamRuntime parseInputStream(SingleInputStream inputStream,ExecutionPlanContext executionPlanContext,List<VariableExpressionExecutor> variableExpressionExecutors,Map<String,AbstractDefinition> streamDefinitionMap,Map<String,AbstractDefinition> tableDefinitionMap,Map<String,EventTable> eventTableMap,MetaComplexEvent metaComplexEvent,ProcessStreamReceiver processStreamReceiver,boolean supportsBatchProcessing,LatencyTracker latencyTracker){
  Processor processor=null;
  SingleThreadEntryValveProcessor singleThreadValve=null;
  boolean first=true;
  MetaStreamEvent metaStreamEvent;
  if (metaComplexEvent instanceof MetaStateEvent) {
    metaStreamEvent=new MetaStreamEvent();
    ((MetaStateEvent)metaComplexEvent).addEvent(metaStreamEvent);
    initMetaStreamEvent(inputStream,streamDefinitionMap,tableDefinitionMap,metaStreamEvent);
  }
 else {
    metaStreamEvent=(MetaStreamEvent)metaComplexEvent;
    initMetaStreamEvent(inputStream,streamDefinitionMap,tableDefinitionMap,metaStreamEvent);
  }
  if (!inputStream.getStreamHandlers().isEmpty()) {
    for (    StreamHandler handler : inputStream.getStreamHandlers()) {
      Processor currentProcessor=generateProcessor(handler,metaComplexEvent,variableExpressionExecutors,executionPlanContext,eventTableMap,supportsBatchProcessing);
      if (currentProcessor instanceof SchedulingProcessor) {
        if (singleThreadValve == null) {
          singleThreadValve=new SingleThreadEntryValveProcessor(executionPlanContext);
          if (first) {
            processor=singleThreadValve;
            first=false;
          }
 else {
            processor.setToLast(singleThreadValve);
          }
        }
        Scheduler scheduler=new Scheduler(executionPlanContext.getScheduledExecutorService(),singleThreadValve);
        scheduler.init(executionPlanContext,latencyTracker);
        ((SchedulingProcessor)currentProcessor).setScheduler(scheduler);
      }
      if (first) {
        processor=currentProcessor;
        first=false;
      }
 else {
        processor.setToLast(currentProcessor);
      }
    }
  }
  metaStreamEvent.initializeAfterWindowData();
  return new SingleStreamRuntime(processStreamReceiver,processor,metaComplexEvent);
}

Fixed version (ground truth):
/** 
 * Parse single InputStream and return SingleStreamRuntime
 * @param inputStream                 single input stream to be parsed
 * @param executionPlanContext        query to be parsed
 * @param variableExpressionExecutors List to hold VariableExpressionExecutors to update after query parsing
 * @param streamDefinitionMap         Stream Definition Map
 * @param tableDefinitionMap          Table Definition Map
 * @param eventTableMap               EventTable Map
 * @param metaComplexEvent            MetaComplexEvent
 * @param processStreamReceiver       ProcessStreamReceiver
 * @param latencyTracker              latency tracker
 * @return SingleStreamRuntime
 */
public static SingleStreamRuntime parseInputStream(SingleInputStream inputStream,ExecutionPlanContext executionPlanContext,List<VariableExpressionExecutor> variableExpressionExecutors,Map<String,AbstractDefinition> streamDefinitionMap,Map<String,AbstractDefinition> tableDefinitionMap,Map<String,EventTable> eventTableMap,MetaComplexEvent metaComplexEvent,ProcessStreamReceiver processStreamReceiver,boolean supportsBatchProcessing,LatencyTracker latencyTracker){
  Processor processor=null;
  SingleThreadEntryValveProcessor singleThreadValve=null;
  boolean first=true;
  MetaStreamEvent metaStreamEvent;
  if (metaComplexEvent instanceof MetaStateEvent) {
    metaStreamEvent=new MetaStreamEvent();
    ((MetaStateEvent)metaComplexEvent).addEvent(metaStreamEvent);
    initMetaStreamEvent(inputStream,streamDefinitionMap,tableDefinitionMap,metaStreamEvent);
  }
 else {
    metaStreamEvent=(MetaStreamEvent)metaComplexEvent;
    initMetaStreamEvent(inputStream,streamDefinitionMap,tableDefinitionMap,metaStreamEvent);
  }
  if (!inputStream.getStreamHandlers().isEmpty()) {
    for (    StreamHandler handler : inputStream.getStreamHandlers()) {
      Processor currentProcessor=generateProcessor(handler,metaComplexEvent,variableExpressionExecutors,executionPlanContext,eventTableMap,supportsBatchProcessing);
      if (currentProcessor instanceof SchedulingProcessor) {
        if (singleThreadValve == null) {
          singleThreadValve=new SingleThreadEntryValveProcessor(executionPlanContext);
          if (first) {
            processor=singleThreadValve;
            first=false;
          }
 else {
            processor.setToLast(singleThreadValve);
          }
        }
        Scheduler scheduler=new Scheduler(executionPlanContext.getScheduledExecutorService(),singleThreadValve);
        scheduler.init(executionPlanContext,latencyTracker);
        ((SchedulingProcessor)currentProcessor).setScheduler(scheduler);
      }
      if (first) {
        processor=currentProcessor;
        first=false;
      }
 else {
        processor.setToLast(currentProcessor);
      }
    }
  }
  metaStreamEvent.initializeAfterWindowData();
  return new SingleStreamRuntime(processStreamReceiver,processor,metaComplexEvent);
}