Program: 29019
Project: 29019
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);
    StreamEvent nextEvent=(StreamEvent)complexEventChunk.getFirst();
    complexEventChunk.clear();
    while (nextEvent != null) {
      StreamEvent streamEvent=nextEvent;
      nextEvent=streamEvent.getNext();
      streamEvent.setNext(null);
      joinLock.lock();
      try {
        if (streamEvent.getType() == ComplexEvent.Type.TIMER) {
          if (preJoinProcessor) {
            complexEventChunk.add(streamEvent);
            nextProcessor.process(complexEventChunk);
            complexEventChunk.clear();
          }
          continue;
        }
 else         if (streamEvent.getType() == ComplexEvent.Type.CURRENT) {
          if (!preJoinProcessor) {
            continue;
          }
        }
 else         if (streamEvent.getType() == ComplexEvent.Type.EXPIRED) {
          if (preJoinProcessor) {
            continue;
          }
        }
        StreamEvent foundStreamEvent=findableProcessor.find(streamEvent,finder);
        if (foundStreamEvent == null) {
          if (outerJoinProcessor && !leftJoinProcessor) {
            returnEventChunk.add(joinEventBuilder(foundStreamEvent,streamEvent));
          }
 else           if (outerJoinProcessor && leftJoinProcessor) {
            returnEventChunk.add(joinEventBuilder(streamEvent,foundStreamEvent));
          }
        }
 else {
          while (foundStreamEvent != null) {
            if (!leftJoinProcessor) {
              returnEventChunk.add(joinEventBuilder(foundStreamEvent,streamEvent));
            }
 else {
              returnEventChunk.add(joinEventBuilder(streamEvent,foundStreamEvent));
            }
            foundStreamEvent=foundStreamEvent.getNext();
          }
        }
        if (preJoinProcessor) {
          complexEventChunk.add(streamEvent);
          nextProcessor.process(complexEventChunk);
          complexEventChunk.clear();
        }
      }
  finally {
        joinLock.unlock();
      }
      if (returnEventChunk.getFirst() != null) {
        selector.process(returnEventChunk);
        returnEventChunk.clear();
      }
    }
  }
 else {
    if (preJoinProcessor) {
      joinLock.lock();
      try {
        nextProcessor.process(complexEventChunk);
      }
  finally {
        joinLock.unlock();
      }
    }
  }
}

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);
    StreamEvent nextEvent=(StreamEvent)complexEventChunk.getFirst();
    complexEventChunk.clear();
    while (nextEvent != null) {
      StreamEvent streamEvent=nextEvent;
      nextEvent=streamEvent.getNext();
      streamEvent.setNext(null);
      joinLock.lock();
      try {
        if (streamEvent.getType() == ComplexEvent.Type.TIMER) {
          if (preJoinProcessor) {
            complexEventChunk.add(streamEvent);
            nextProcessor.process(complexEventChunk);
            complexEventChunk.clear();
          }
          continue;
        }
 else         if (streamEvent.getType() == ComplexEvent.Type.CURRENT) {
          if (!preJoinProcessor) {
            continue;
          }
        }
 else         if (streamEvent.getType() == ComplexEvent.Type.EXPIRED) {
          if (preJoinProcessor) {
            continue;
          }
        }
 else         if (streamEvent.getType() == ComplexEvent.Type.RESET) {
          continue;
        }
        StreamEvent foundStreamEvent=findableProcessor.find(streamEvent,finder);
        if (foundStreamEvent == null) {
          if (outerJoinProcessor && !leftJoinProcessor) {
            returnEventChunk.add(joinEventBuilder(foundStreamEvent,streamEvent));
          }
 else           if (outerJoinProcessor && leftJoinProcessor) {
            returnEventChunk.add(joinEventBuilder(streamEvent,foundStreamEvent));
          }
        }
 else {
          while (foundStreamEvent != null) {
            if (!leftJoinProcessor) {
              returnEventChunk.add(joinEventBuilder(foundStreamEvent,streamEvent));
            }
 else {
              returnEventChunk.add(joinEventBuilder(streamEvent,foundStreamEvent));
            }
            foundStreamEvent=foundStreamEvent.getNext();
          }
        }
        if (preJoinProcessor) {
          complexEventChunk.add(streamEvent);
          nextProcessor.process(complexEventChunk);
          complexEventChunk.clear();
        }
      }
  finally {
        joinLock.unlock();
      }
      if (returnEventChunk.getFirst() != null) {
        selector.process(returnEventChunk);
        returnEventChunk.clear();
      }
    }
  }
 else {
    if (preJoinProcessor) {
      joinLock.lock();
      try {
        nextProcessor.process(complexEventChunk);
      }
  finally {
        joinLock.unlock();
      }
    }
  }
}