Program: 28950
Project: 28950
Buggy source:
/** 
 * Process the handed StreamEvent
 * @param complexEventChunk event chunk to be processed
 */
@Override public void process(ComplexEventChunk complexEventChunk){
  if (trigger) {
    ComplexEventChunk<StateEvent> returnEventChunk=new ComplexEventChunk<StateEvent>(true);
    StateEvent joinStateEvent=new StateEvent(2,0);
    StreamEvent nextEvent=(StreamEvent)complexEventChunk.getFirst();
    complexEventChunk.clear();
    while (nextEvent != null) {
      StreamEvent streamEvent=nextEvent;
      nextEvent=streamEvent.getNext();
      streamEvent.setNext(null);
      joinLockWrapper.lock();
      try {
        ComplexEvent.Type eventType=streamEvent.getType();
        if (eventType == ComplexEvent.Type.TIMER) {
          continue;
        }
 else         if (eventType == ComplexEvent.Type.RESET) {
          if (outerJoinProcessor && !leftJoinProcessor) {
            returnEventChunk.add(joinEventBuilder(null,streamEvent,eventType));
          }
 else           if (outerJoinProcessor && leftJoinProcessor) {
            returnEventChunk.add(joinEventBuilder(streamEvent,null,eventType));
          }
        }
 else {
          joinStateEvent.setEvent(matchingStreamIndex,streamEvent);
          StreamEvent foundStreamEvent=findableProcessor.find(joinStateEvent,finder);
          joinStateEvent.setEvent(matchingStreamIndex,null);
          if (foundStreamEvent == null) {
            if (outerJoinProcessor && !leftJoinProcessor) {
              returnEventChunk.add(joinEventBuilder(foundStreamEvent,streamEvent,eventType));
            }
 else             if (outerJoinProcessor && leftJoinProcessor) {
              returnEventChunk.add(joinEventBuilder(streamEvent,foundStreamEvent,eventType));
            }
          }
 else {
            while (foundStreamEvent != null) {
              if (!leftJoinProcessor) {
                returnEventChunk.add(joinEventBuilder(foundStreamEvent,streamEvent,eventType));
              }
 else {
                returnEventChunk.add(joinEventBuilder(streamEvent,foundStreamEvent,eventType));
              }
              foundStreamEvent=foundStreamEvent.getNext();
            }
          }
        }
      }
  finally {
        joinLockWrapper.unlock();
      }
      if (returnEventChunk.getFirst() != null) {
        selector.process(returnEventChunk);
        returnEventChunk.clear();
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Process the handed StreamEvent
 * @param complexEventChunk event chunk to be processed
 */
@Override public void process(ComplexEventChunk complexEventChunk){
  if (trigger) {
    ComplexEventChunk<StateEvent> returnEventChunk=new ComplexEventChunk<StateEvent>(true);
    StateEvent joinStateEvent=new StateEvent(2,0);
    StreamEvent nextEvent=(StreamEvent)complexEventChunk.getFirst();
    complexEventChunk.clear();
    while (nextEvent != null) {
      StreamEvent streamEvent=nextEvent;
      nextEvent=streamEvent.getNext();
      streamEvent.setNext(null);
      joinLockWrapper.lock();
      try {
        ComplexEvent.Type eventType=streamEvent.getType();
        if (eventType == ComplexEvent.Type.TIMER) {
          continue;
        }
 else         if (eventType == ComplexEvent.Type.RESET) {
          if (outerJoinProcessor && !leftJoinProcessor) {
            returnEventChunk.add(joinEventBuilder(null,streamEvent,eventType));
          }
 else           if (outerJoinProcessor && leftJoinProcessor) {
            returnEventChunk.add(joinEventBuilder(streamEvent,null,eventType));
          }
        }
 else {
          joinStateEvent.setEvent(matchingStreamIndex,streamEvent);
          StreamEvent foundStreamEvent=findableProcessor.find(joinStateEvent,finder);
          joinStateEvent.setEvent(matchingStreamIndex,null);
          if (foundStreamEvent == null) {
            if (outerJoinProcessor && !leftJoinProcessor) {
              returnEventChunk.add(joinEventBuilder(foundStreamEvent,streamEvent,eventType));
            }
 else             if (outerJoinProcessor && leftJoinProcessor) {
              returnEventChunk.add(joinEventBuilder(streamEvent,foundStreamEvent,eventType));
            }
          }
 else {
            while (foundStreamEvent != null) {
              if (!leftJoinProcessor) {
                returnEventChunk.add(joinEventBuilder(foundStreamEvent,streamEvent,eventType));
              }
 else {
                returnEventChunk.add(joinEventBuilder(streamEvent,foundStreamEvent,eventType));
              }
              foundStreamEvent=foundStreamEvent.getNext();
            }
          }
        }
      }
  finally {
        joinLockWrapper.unlock();
      }
      if (returnEventChunk.getFirst() != null) {
        selector.process(returnEventChunk);
        returnEventChunk.clear();
      }
    }
  }
 else {
    if (preJoinProcessor) {
      joinLockWrapper.lock();
      try {
        nextProcessor.process(complexEventChunk);
      }
  finally {
        joinLockWrapper.unlock();
      }
    }
  }
}