Program: 28961
Project: 28961
Buggy source:
public static StreamRuntime parseInputStream(JoinInputStream joinInputStream,ExecutionPlanContext executionPlanContext,Map<String,AbstractDefinition> streamDefinitionMap,Map<String,AbstractDefinition> tableDefinitionMap,Map<String,AbstractDefinition> windowDefinitionMap,Map<String,EventTable> eventTableMap,Map<String,EventWindow> eventWindowMap,List<VariableExpressionExecutor> executors,LatencyTracker latencyTracker,boolean outputExpectsExpiredEvents){
  ProcessStreamReceiver leftProcessStreamReceiver;
  ProcessStreamReceiver rightProcessStreamReceiver;
  MetaStreamEvent leftMetaStreamEvent=new MetaStreamEvent();
  MetaStreamEvent rightMetaStreamEvent=new MetaStreamEvent();
  String leftInputStreamId=((SingleInputStream)joinInputStream.getLeftInputStream()).getStreamId();
  String rightInputStreamId=((SingleInputStream)joinInputStream.getRightInputStream()).getStreamId();
  boolean leftOuterJoinProcessor=false;
  boolean rightOuterJoinProcessor=false;
  if (joinInputStream.getAllStreamIds().size() == 2) {
    if (windowDefinitionMap.containsKey(leftInputStreamId)) {
      leftMetaStreamEvent.setWindowEvent(true);
    }
 else     if (!streamDefinitionMap.containsKey(leftInputStreamId)) {
      if (tableDefinitionMap.containsKey(leftInputStreamId)) {
        leftMetaStreamEvent.setTableEvent(true);
      }
    }
    if (windowDefinitionMap.containsKey(rightInputStreamId)) {
      rightMetaStreamEvent.setWindowEvent(true);
    }
 else     if (!streamDefinitionMap.containsKey(rightInputStreamId)) {
      if (tableDefinitionMap.containsKey(rightInputStreamId)) {
        rightMetaStreamEvent.setTableEvent(true);
      }
    }
    leftProcessStreamReceiver=new ProcessStreamReceiver(leftInputStreamId,latencyTracker);
    leftProcessStreamReceiver.setBatchProcessingAllowed(leftMetaStreamEvent.isWindowEvent());
    rightProcessStreamReceiver=new ProcessStreamReceiver(rightInputStreamId,latencyTracker);
    rightProcessStreamReceiver.setBatchProcessingAllowed(rightMetaStreamEvent.isWindowEvent());
    if (leftMetaStreamEvent.isTableEvent() && rightMetaStreamEvent.isTableEvent()) {
      throw new ExecutionPlanCreationException("String_Node_Str" + leftInputStreamId + "String_Node_Str"+ rightInputStreamId);
    }
  }
 else {
    if (windowDefinitionMap.containsKey(joinInputStream.getAllStreamIds().get(0))) {
      leftMetaStreamEvent.setWindowEvent(true);
      rightMetaStreamEvent.setWindowEvent(true);
      rightProcessStreamReceiver=new MultiProcessStreamReceiver(joinInputStream.getAllStreamIds().get(0),1,latencyTracker);
      rightProcessStreamReceiver.setBatchProcessingAllowed(true);
      leftProcessStreamReceiver=rightProcessStreamReceiver;
    }
 else     if (streamDefinitionMap.containsKey(joinInputStream.getAllStreamIds().get(0))) {
      rightProcessStreamReceiver=new MultiProcessStreamReceiver(joinInputStream.getAllStreamIds().get(0),2,latencyTracker);
      leftProcessStreamReceiver=rightProcessStreamReceiver;
    }
 else {
      throw new ExecutionPlanCreationException("String_Node_Str" + leftInputStreamId + "String_Node_Str"+ rightInputStreamId);
    }
  }
  SingleStreamRuntime leftStreamRuntime=SingleInputStreamParser.parseInputStream((SingleInputStream)joinInputStream.getLeftInputStream(),executionPlanContext,executors,streamDefinitionMap,!leftMetaStreamEvent.isTableEvent() ? null : tableDefinitionMap,!leftMetaStreamEvent.isWindowEvent() ? null : windowDefinitionMap,eventTableMap,leftMetaStreamEvent,leftProcessStreamReceiver,true,outputExpectsExpiredEvents);
  for (  VariableExpressionExecutor variableExpressionExecutor : executors) {
    variableExpressionExecutor.getPosition()[SiddhiConstants.STREAM_EVENT_CHAIN_INDEX]=0;
  }
  int size=executors.size();
  SingleStreamRuntime rightStreamRuntime=SingleInputStreamParser.parseInputStream((SingleInputStream)joinInputStream.getRightInputStream(),executionPlanContext,executors,streamDefinitionMap,!rightMetaStreamEvent.isTableEvent() ? null : tableDefinitionMap,!rightMetaStreamEvent.isWindowEvent() ? null : windowDefinitionMap,eventTableMap,rightMetaStreamEvent,rightProcessStreamReceiver,true,outputExpectsExpiredEvents);
  for (int i=size; i < executors.size(); i++) {
    VariableExpressionExecutor variableExpressionExecutor=executors.get(i);
    variableExpressionExecutor.getPosition()[SiddhiConstants.STREAM_EVENT_CHAIN_INDEX]=1;
  }
  if (leftMetaStreamEvent.isTableEvent()) {
    TableWindowProcessor tableWindowProcessor=new TableWindowProcessor(eventTableMap.get(leftInputStreamId));
    tableWindowProcessor.initProcessor(leftMetaStreamEvent.getLastInputDefinition(),new ExpressionExecutor[0],executionPlanContext,outputExpectsExpiredEvents);
    leftStreamRuntime.setProcessorChain(tableWindowProcessor);
  }
 else   if (leftMetaStreamEvent.isWindowEvent()) {
    WindowWindowProcessor windowWindowProcessor=new WindowWindowProcessor(eventWindowMap.get(leftInputStreamId));
    windowWindowProcessor.initProcessor(leftMetaStreamEvent.getLastInputDefinition(),executors.toArray(new ExpressionExecutor[0]),executionPlanContext,outputExpectsExpiredEvents);
    leftStreamRuntime.setProcessorChain(windowWindowProcessor);
  }
  if (rightMetaStreamEvent.isTableEvent()) {
    TableWindowProcessor tableWindowProcessor=new TableWindowProcessor(eventTableMap.get(rightInputStreamId));
    tableWindowProcessor.initProcessor(rightMetaStreamEvent.getLastInputDefinition(),new ExpressionExecutor[0],executionPlanContext,outputExpectsExpiredEvents);
    rightStreamRuntime.setProcessorChain(tableWindowProcessor);
  }
 else   if (rightMetaStreamEvent.isWindowEvent()) {
    WindowWindowProcessor windowWindowProcessor=new WindowWindowProcessor(eventWindowMap.get(rightInputStreamId));
    windowWindowProcessor.initProcessor(rightMetaStreamEvent.getLastInputDefinition(),executors.toArray(new ExpressionExecutor[0]),executionPlanContext,outputExpectsExpiredEvents);
    rightStreamRuntime.setProcessorChain(windowWindowProcessor);
  }
  MetaStateEvent metaStateEvent=new MetaStateEvent(2);
  metaStateEvent.addEvent(leftMetaStreamEvent);
  metaStateEvent.addEvent(rightMetaStreamEvent);
switch (joinInputStream.getType()) {
case FULL_OUTER_JOIN:
    leftOuterJoinProcessor=true;
case RIGHT_OUTER_JOIN:
  rightOuterJoinProcessor=true;
break;
case LEFT_OUTER_JOIN:
leftOuterJoinProcessor=true;
break;
}
Lock joinLock=new ReentrantLock();
JoinProcessor leftPreJoinProcessor=new JoinProcessor(true,true,leftOuterJoinProcessor,0);
JoinProcessor leftPostJoinProcessor=new JoinProcessor(true,false,leftOuterJoinProcessor,0);
FindableProcessor leftFindableProcessor=insertJoinProcessorsAndGetFindable(leftPreJoinProcessor,leftPostJoinProcessor,leftStreamRuntime,executionPlanContext,outputExpectsExpiredEvents);
JoinProcessor rightPreJoinProcessor=new JoinProcessor(false,true,rightOuterJoinProcessor,1);
JoinProcessor rightPostJoinProcessor=new JoinProcessor(false,false,rightOuterJoinProcessor,1);
FindableProcessor rightFindableProcessor=insertJoinProcessorsAndGetFindable(rightPreJoinProcessor,rightPostJoinProcessor,rightStreamRuntime,executionPlanContext,outputExpectsExpiredEvents);
leftPreJoinProcessor.setFindableProcessor(rightFindableProcessor);
leftPreJoinProcessor.setJoinLock(joinLock);
leftPostJoinProcessor.setFindableProcessor(rightFindableProcessor);
leftPostJoinProcessor.setJoinLock(joinLock);
rightPreJoinProcessor.setFindableProcessor(leftFindableProcessor);
rightPreJoinProcessor.setJoinLock(joinLock);
rightPostJoinProcessor.setFindableProcessor(leftFindableProcessor);
rightPostJoinProcessor.setJoinLock(joinLock);
Expression compareCondition=joinInputStream.getOnCompare();
if (compareCondition == null) {
compareCondition=Expression.value(true);
}
if (joinInputStream.getWithin() != null) {
throw new OperationNotSupportedException("String_Node_Str" + ((TimeConstant)joinInputStream.getWithin()).getValue() + "String_Node_Str");
}
MatchingMetaStateHolder rightMatchingMetaStateHolder=MatcherParser.constructMatchingMetaStateHolder(metaStateEvent,0,rightMetaStreamEvent.getLastInputDefinition());
Finder leftFinder=rightFindableProcessor.constructFinder(compareCondition,rightMatchingMetaStateHolder,executionPlanContext,executors,eventTableMap);
MatchingMetaStateHolder leftMatchingMetaStateHolder=MatcherParser.constructMatchingMetaStateHolder(metaStateEvent,1,leftMetaStreamEvent.getLastInputDefinition());
Finder rightFinder=leftFindableProcessor.constructFinder(compareCondition,leftMatchingMetaStateHolder,executionPlanContext,executors,eventTableMap);
if (joinInputStream.getTrigger() != JoinInputStream.EventTrigger.LEFT) {
rightPreJoinProcessor.setTrigger(false);
rightPreJoinProcessor.setFinder(rightFinder);
rightPostJoinProcessor.setTrigger(true);
rightPostJoinProcessor.setFinder(rightFinder);
}
if (joinInputStream.getTrigger() != JoinInputStream.EventTrigger.RIGHT) {
leftPreJoinProcessor.setTrigger(false);
leftPreJoinProcessor.setFinder(leftFinder);
leftPostJoinProcessor.setTrigger(true);
leftPostJoinProcessor.setFinder(leftFinder);
}
JoinStreamRuntime joinStreamRuntime=new JoinStreamRuntime(executionPlanContext,metaStateEvent);
joinStreamRuntime.addRuntime(leftStreamRuntime);
joinStreamRuntime.addRuntime(rightStreamRuntime);
return joinStreamRuntime;
}

Fixed version (ground truth):
public static StreamRuntime parseInputStream(JoinInputStream joinInputStream,ExecutionPlanContext executionPlanContext,Map<String,AbstractDefinition> streamDefinitionMap,Map<String,AbstractDefinition> tableDefinitionMap,Map<String,AbstractDefinition> windowDefinitionMap,Map<String,EventTable> eventTableMap,Map<String,EventWindow> eventWindowMap,List<VariableExpressionExecutor> executors,LatencyTracker latencyTracker,boolean outputExpectsExpiredEvents){
  ProcessStreamReceiver leftProcessStreamReceiver;
  ProcessStreamReceiver rightProcessStreamReceiver;
  MetaStreamEvent leftMetaStreamEvent=new MetaStreamEvent();
  MetaStreamEvent rightMetaStreamEvent=new MetaStreamEvent();
  String leftInputStreamId=((SingleInputStream)joinInputStream.getLeftInputStream()).getStreamId();
  String rightInputStreamId=((SingleInputStream)joinInputStream.getRightInputStream()).getStreamId();
  boolean leftOuterJoinProcessor=false;
  boolean rightOuterJoinProcessor=false;
  if (joinInputStream.getAllStreamIds().size() == 2) {
    if (windowDefinitionMap.containsKey(leftInputStreamId)) {
      leftMetaStreamEvent.setWindowEvent(true);
    }
 else     if (!streamDefinitionMap.containsKey(leftInputStreamId)) {
      if (tableDefinitionMap.containsKey(leftInputStreamId)) {
        leftMetaStreamEvent.setTableEvent(true);
      }
    }
    if (windowDefinitionMap.containsKey(rightInputStreamId)) {
      rightMetaStreamEvent.setWindowEvent(true);
    }
 else     if (!streamDefinitionMap.containsKey(rightInputStreamId)) {
      if (tableDefinitionMap.containsKey(rightInputStreamId)) {
        rightMetaStreamEvent.setTableEvent(true);
      }
    }
    leftProcessStreamReceiver=new ProcessStreamReceiver(leftInputStreamId,latencyTracker);
    leftProcessStreamReceiver.setBatchProcessingAllowed(leftMetaStreamEvent.isWindowEvent());
    rightProcessStreamReceiver=new ProcessStreamReceiver(rightInputStreamId,latencyTracker);
    rightProcessStreamReceiver.setBatchProcessingAllowed(rightMetaStreamEvent.isWindowEvent());
    if (leftMetaStreamEvent.isTableEvent() && rightMetaStreamEvent.isTableEvent()) {
      throw new ExecutionPlanCreationException("String_Node_Str" + leftInputStreamId + "String_Node_Str"+ rightInputStreamId);
    }
  }
 else {
    if (windowDefinitionMap.containsKey(joinInputStream.getAllStreamIds().get(0))) {
      leftMetaStreamEvent.setWindowEvent(true);
      rightMetaStreamEvent.setWindowEvent(true);
      rightProcessStreamReceiver=new MultiProcessStreamReceiver(joinInputStream.getAllStreamIds().get(0),1,latencyTracker);
      rightProcessStreamReceiver.setBatchProcessingAllowed(true);
      leftProcessStreamReceiver=rightProcessStreamReceiver;
    }
 else     if (streamDefinitionMap.containsKey(joinInputStream.getAllStreamIds().get(0))) {
      rightProcessStreamReceiver=new MultiProcessStreamReceiver(joinInputStream.getAllStreamIds().get(0),2,latencyTracker);
      leftProcessStreamReceiver=rightProcessStreamReceiver;
    }
 else {
      throw new ExecutionPlanCreationException("String_Node_Str" + leftInputStreamId + "String_Node_Str"+ rightInputStreamId);
    }
  }
  SingleStreamRuntime leftStreamRuntime=SingleInputStreamParser.parseInputStream((SingleInputStream)joinInputStream.getLeftInputStream(),executionPlanContext,executors,streamDefinitionMap,!leftMetaStreamEvent.isTableEvent() ? null : tableDefinitionMap,!leftMetaStreamEvent.isWindowEvent() ? null : windowDefinitionMap,eventTableMap,leftMetaStreamEvent,leftProcessStreamReceiver,true,outputExpectsExpiredEvents);
  for (  VariableExpressionExecutor variableExpressionExecutor : executors) {
    variableExpressionExecutor.getPosition()[SiddhiConstants.STREAM_EVENT_CHAIN_INDEX]=0;
  }
  int size=executors.size();
  SingleStreamRuntime rightStreamRuntime=SingleInputStreamParser.parseInputStream((SingleInputStream)joinInputStream.getRightInputStream(),executionPlanContext,executors,streamDefinitionMap,!rightMetaStreamEvent.isTableEvent() ? null : tableDefinitionMap,!rightMetaStreamEvent.isWindowEvent() ? null : windowDefinitionMap,eventTableMap,rightMetaStreamEvent,rightProcessStreamReceiver,true,outputExpectsExpiredEvents);
  for (int i=size; i < executors.size(); i++) {
    VariableExpressionExecutor variableExpressionExecutor=executors.get(i);
    variableExpressionExecutor.getPosition()[SiddhiConstants.STREAM_EVENT_CHAIN_INDEX]=1;
  }
  if (leftMetaStreamEvent.isTableEvent()) {
    TableWindowProcessor tableWindowProcessor=new TableWindowProcessor(eventTableMap.get(leftInputStreamId));
    tableWindowProcessor.initProcessor(leftMetaStreamEvent.getLastInputDefinition(),new ExpressionExecutor[0],executionPlanContext,outputExpectsExpiredEvents);
    leftStreamRuntime.setProcessorChain(tableWindowProcessor);
  }
 else   if (leftMetaStreamEvent.isWindowEvent()) {
    WindowWindowProcessor windowWindowProcessor=new WindowWindowProcessor(eventWindowMap.get(leftInputStreamId));
    windowWindowProcessor.initProcessor(leftMetaStreamEvent.getLastInputDefinition(),executors.toArray(new ExpressionExecutor[0]),executionPlanContext,outputExpectsExpiredEvents);
    leftStreamRuntime.setProcessorChain(windowWindowProcessor);
  }
  if (rightMetaStreamEvent.isTableEvent()) {
    TableWindowProcessor tableWindowProcessor=new TableWindowProcessor(eventTableMap.get(rightInputStreamId));
    tableWindowProcessor.initProcessor(rightMetaStreamEvent.getLastInputDefinition(),new ExpressionExecutor[0],executionPlanContext,outputExpectsExpiredEvents);
    rightStreamRuntime.setProcessorChain(tableWindowProcessor);
  }
 else   if (rightMetaStreamEvent.isWindowEvent()) {
    WindowWindowProcessor windowWindowProcessor=new WindowWindowProcessor(eventWindowMap.get(rightInputStreamId));
    windowWindowProcessor.initProcessor(rightMetaStreamEvent.getLastInputDefinition(),executors.toArray(new ExpressionExecutor[0]),executionPlanContext,outputExpectsExpiredEvents);
    rightStreamRuntime.setProcessorChain(windowWindowProcessor);
  }
  MetaStateEvent metaStateEvent=new MetaStateEvent(2);
  metaStateEvent.addEvent(leftMetaStreamEvent);
  metaStateEvent.addEvent(rightMetaStreamEvent);
switch (joinInputStream.getType()) {
case FULL_OUTER_JOIN:
    leftOuterJoinProcessor=true;
case RIGHT_OUTER_JOIN:
  rightOuterJoinProcessor=true;
break;
case LEFT_OUTER_JOIN:
leftOuterJoinProcessor=true;
break;
}
JoinProcessor leftPostJoinProcessor=new JoinProcessor(true,leftOuterJoinProcessor,0);
JoinProcessor rightPostJoinProcessor=new JoinProcessor(false,rightOuterJoinProcessor,1);
FindableProcessor leftFindableProcessor=insertJoinProcessorsAndGetFindable(leftPostJoinProcessor,leftStreamRuntime,executionPlanContext,outputExpectsExpiredEvents);
FindableProcessor rightFindableProcessor=insertJoinProcessorsAndGetFindable(rightPostJoinProcessor,rightStreamRuntime,executionPlanContext,outputExpectsExpiredEvents);
leftPostJoinProcessor.setFindableProcessor(rightFindableProcessor);
rightPostJoinProcessor.setFindableProcessor(leftFindableProcessor);
Expression compareCondition=joinInputStream.getOnCompare();
if (compareCondition == null) {
compareCondition=Expression.value(true);
}
if (joinInputStream.getWithin() != null) {
throw new OperationNotSupportedException("String_Node_Str" + ((TimeConstant)joinInputStream.getWithin()).getValue() + "String_Node_Str");
}
MatchingMetaStateHolder rightMatchingMetaStateHolder=MatcherParser.constructMatchingMetaStateHolder(metaStateEvent,0,rightMetaStreamEvent.getLastInputDefinition());
Finder leftFinder=rightFindableProcessor.constructFinder(compareCondition,rightMatchingMetaStateHolder,executionPlanContext,executors,eventTableMap);
MatchingMetaStateHolder leftMatchingMetaStateHolder=MatcherParser.constructMatchingMetaStateHolder(metaStateEvent,1,leftMetaStreamEvent.getLastInputDefinition());
Finder rightFinder=leftFindableProcessor.constructFinder(compareCondition,leftMatchingMetaStateHolder,executionPlanContext,executors,eventTableMap);
if (joinInputStream.getTrigger() != JoinInputStream.EventTrigger.LEFT) {
rightPostJoinProcessor.setTrigger(true);
rightPostJoinProcessor.setFinder(rightFinder);
}
if (joinInputStream.getTrigger() != JoinInputStream.EventTrigger.RIGHT) {
leftPostJoinProcessor.setTrigger(true);
leftPostJoinProcessor.setFinder(leftFinder);
}
JoinStreamRuntime joinStreamRuntime=new JoinStreamRuntime(executionPlanContext,metaStateEvent);
joinStreamRuntime.addRuntime(leftStreamRuntime);
joinStreamRuntime.addRuntime(rightStreamRuntime);
return joinStreamRuntime;
}