Program: 28743
Project: 28743
Buggy source:
/** 
 * Parse single InputStream and return SingleStreamRuntime
 * @param inputStream                 single input stream to be parsed
 * @param siddhiAppContext            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 windowDefinitionMap         window definition map
 * @param aggregationDefinitionMap    aggregation definition map
 * @param tableMap                    Table Map
 * @param metaComplexEvent            MetaComplexEvent
 * @param processStreamReceiver       ProcessStreamReceiver
 * @param supportsBatchProcessing     supports batch processing
 * @param outputExpectsExpiredEvents  is output expects ExpiredEvents
 * @param queryName                   query name of single input stream belongs to.       @return SingleStreamRuntime
 */
public static SingleStreamRuntime parseInputStream(SingleInputStream inputStream,SiddhiAppContext siddhiAppContext,List<VariableExpressionExecutor> variableExpressionExecutors,Map<String,AbstractDefinition> streamDefinitionMap,Map<String,AbstractDefinition> tableDefinitionMap,Map<String,AbstractDefinition> windowDefinitionMap,Map<String,AbstractDefinition> aggregationDefinitionMap,Map<String,Table> tableMap,MetaComplexEvent metaComplexEvent,ProcessStreamReceiver processStreamReceiver,boolean supportsBatchProcessing,boolean outputExpectsExpiredEvents,String queryName){
  Processor processor=null;
  EntryValveProcessor entryValveProcessor=null;
  boolean first=true;
  MetaStreamEvent metaStreamEvent;
  if (metaComplexEvent instanceof MetaStateEvent) {
    metaStreamEvent=new MetaStreamEvent();
    ((MetaStateEvent)metaComplexEvent).addEvent(metaStreamEvent);
    initMetaStreamEvent(inputStream,streamDefinitionMap,tableDefinitionMap,windowDefinitionMap,aggregationDefinitionMap,metaStreamEvent);
  }
 else {
    metaStreamEvent=(MetaStreamEvent)metaComplexEvent;
    initMetaStreamEvent(inputStream,streamDefinitionMap,tableDefinitionMap,windowDefinitionMap,aggregationDefinitionMap,metaStreamEvent);
  }
  if (!inputStream.getStreamHandlers().isEmpty() && windowDefinitionMap != null && windowDefinitionMap.containsKey(inputStream.getStreamId())) {
    for (    StreamHandler handler : inputStream.getStreamHandlers()) {
      if (handler instanceof Window) {
        throw new OperationNotSupportedException("String_Node_Str" + ((Window)handler).getName() + "String_Node_Str"+ "String_Node_Str"+ inputStream.getStreamId());
      }
    }
  }
  if (!inputStream.getStreamHandlers().isEmpty()) {
    for (    StreamHandler handler : inputStream.getStreamHandlers()) {
      Processor currentProcessor=generateProcessor(handler,metaComplexEvent,variableExpressionExecutors,siddhiAppContext,tableMap,supportsBatchProcessing,outputExpectsExpiredEvents,queryName);
      if (currentProcessor instanceof SchedulingProcessor) {
        if (entryValveProcessor == null) {
          entryValveProcessor=new EntryValveProcessor(siddhiAppContext);
          if (first) {
            processor=entryValveProcessor;
            first=false;
          }
 else {
            processor.setToLast(entryValveProcessor);
          }
        }
        Scheduler scheduler=SchedulerParser.parse(siddhiAppContext.getScheduledExecutorService(),entryValveProcessor,siddhiAppContext);
        ((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 siddhiAppContext            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 windowDefinitionMap         window definition map
 * @param aggregationDefinitionMap    aggregation definition map
 * @param tableMap                    Table Map
 * @param metaComplexEvent            MetaComplexEvent
 * @param processStreamReceiver       ProcessStreamReceiver
 * @param supportsBatchProcessing     supports batch processing
 * @param outputExpectsExpiredEvents  is output expects ExpiredEvents
 * @param queryName                   query name of single input stream belongs to.
 * @return SingleStreamRuntime
 */
public static SingleStreamRuntime parseInputStream(SingleInputStream inputStream,SiddhiAppContext siddhiAppContext,List<VariableExpressionExecutor> variableExpressionExecutors,Map<String,AbstractDefinition> streamDefinitionMap,Map<String,AbstractDefinition> tableDefinitionMap,Map<String,AbstractDefinition> windowDefinitionMap,Map<String,AbstractDefinition> aggregationDefinitionMap,Map<String,Table> tableMap,MetaComplexEvent metaComplexEvent,ProcessStreamReceiver processStreamReceiver,boolean supportsBatchProcessing,boolean outputExpectsExpiredEvents,String queryName){
  Processor processor=null;
  EntryValveProcessor entryValveProcessor=null;
  boolean first=true;
  MetaStreamEvent metaStreamEvent;
  if (metaComplexEvent instanceof MetaStateEvent) {
    metaStreamEvent=new MetaStreamEvent();
    ((MetaStateEvent)metaComplexEvent).addEvent(metaStreamEvent);
    initMetaStreamEvent(inputStream,streamDefinitionMap,tableDefinitionMap,windowDefinitionMap,aggregationDefinitionMap,metaStreamEvent);
  }
 else {
    metaStreamEvent=(MetaStreamEvent)metaComplexEvent;
    initMetaStreamEvent(inputStream,streamDefinitionMap,tableDefinitionMap,windowDefinitionMap,aggregationDefinitionMap,metaStreamEvent);
  }
  if (!inputStream.getStreamHandlers().isEmpty() && windowDefinitionMap != null && windowDefinitionMap.containsKey(inputStream.getStreamId())) {
    for (    StreamHandler handler : inputStream.getStreamHandlers()) {
      if (handler instanceof Window) {
        throw new OperationNotSupportedException("String_Node_Str" + ((Window)handler).getName() + "String_Node_Str"+ "String_Node_Str"+ inputStream.getStreamId());
      }
    }
  }
  if (!inputStream.getStreamHandlers().isEmpty()) {
    for (    StreamHandler handler : inputStream.getStreamHandlers()) {
      Processor currentProcessor=generateProcessor(handler,metaComplexEvent,variableExpressionExecutors,siddhiAppContext,tableMap,supportsBatchProcessing,outputExpectsExpiredEvents,queryName);
      if (currentProcessor instanceof SchedulingProcessor) {
        if (entryValveProcessor == null) {
          entryValveProcessor=new EntryValveProcessor(siddhiAppContext);
          if (first) {
            processor=entryValveProcessor;
            first=false;
          }
 else {
            processor.setToLast(entryValveProcessor);
          }
        }
        Scheduler scheduler=SchedulerParser.parse(siddhiAppContext.getScheduledExecutorService(),entryValveProcessor,siddhiAppContext);
        ((SchedulingProcessor)currentProcessor).setScheduler(scheduler);
      }
      if (first) {
        processor=currentProcessor;
        first=false;
      }
 else {
        processor.setToLast(currentProcessor);
      }
    }
  }
  metaStreamEvent.initializeAfterWindowData();
  return new SingleStreamRuntime(processStreamReceiver,processor,metaComplexEvent);
}