nus-yam/ex-repair huggingface dataset:
Program: 29129
Project: 29129
Buggy source:
@Override public void add(ComplexEvent complexEvent){
  try {
    lock.lock();
    if (complexEvent.getType() == ComplexEvent.Type.CURRENT) {
      String groupByKey=QuerySelector.getThreadLocalGroupByKey();
      if (tempGroupByKeyEvents.containsKey(groupByKey)) {
        tempGroupByKeyEvents.get(groupByKey).add(complexEvent);
      }
 else {
        List<ComplexEvent> newEventChunk=new ArrayList<ComplexEvent>();
        newEventChunk.add(complexEvent);
        tempGroupByKeyEvents.put(groupByKey,newEventChunk);
      }
    }
  }
  finally {
    lock.unlock();
  }
}

Fixed version (ground truth):
/** 
 * Stores the given complex event to send upon notification of the scheduler. If there is already an event with same group by key it will be replaced leaving most recent event per group by key.
 * @param complexEvent {@link org.wso2.siddhi.core.event.ComplexEvent} to be added.
 */
@Override public void add(ComplexEvent complexEvent){
  try {
    lock.lock();
    if (complexEvent.getType() == ComplexEvent.Type.CURRENT) {
      String groupByKey=QuerySelector.getThreadLocalGroupByKey();
      groupByKeyEvents.put(groupByKey,complexEvent);
    }
  }
  finally {
    lock.unlock();
  }
}
Program: 29130
Project: 29130
Buggy source:
@Override public void process(ComplexEventChunk complexEventChunk){
  ComplexEvent firstEvent=complexEventChunk.getFirst();
  try {
    lock.lock();
    if (firstEvent != null && firstEvent.getType() == ComplexEvent.Type.TIMER) {
      if (firstEvent.getTimestamp() >= scheduledTime) {
        sendEvents();
        scheduledTime=scheduledTime + value;
        scheduler.notifyAt(scheduledTime);
      }
    }
 else {
      for (      String key : tempGroupByKeyEvents.keySet()) {
        groupByKeyEvents.put(key,tempGroupByKeyEvents.get(key));
      }
      tempGroupByKeyEvents.clear();
    }
  }
  finally {
    lock.unlock();
  }
}

Fixed version (ground truth):
/** 
 * Sends the collected unique outputs per group by key upon arrival of timer event from scheduler.
 * @param complexEventChunk Incoming {@link org.wso2.siddhi.core.event.ComplexEventChunk}
 */
@Override public void process(ComplexEventChunk complexEventChunk){
  ComplexEvent firstEvent=complexEventChunk.getFirst();
  try {
    lock.lock();
    if (firstEvent != null && firstEvent.getType() == ComplexEvent.Type.TIMER) {
      if (firstEvent.getTimestamp() >= scheduledTime) {
        sendEvents();
        scheduledTime=scheduledTime + value;
        scheduler.notifyAt(scheduledTime);
      }
    }
  }
  finally {
    lock.unlock();
  }
}
Program: 29131
Project: 29131
Buggy source:
@Override public void restoreState(Object[] state){
  tempGroupByKeyEvents=(Map<String,List<ComplexEvent>>)state[0];
  groupByKeyEvents=(Map<String,List<ComplexEvent>>)state[1];
}

Fixed version (ground truth):
@Override public void restoreState(Object[] state){
  groupByKeyEvents=(Map<String,ComplexEvent>)state[0];
}
Program: 29132
Project: 29132
Buggy source:
public synchronized void sendEvents(){
  ComplexEvent firstEvent=null;
  ComplexEvent lastEvent=null;
  for (  List<ComplexEvent> complexEventList : groupByKeyEvents.values()) {
    for (    ComplexEvent complexEvent : complexEventList) {
      if (firstEvent == null) {
        firstEvent=complexEvent;
      }
 else {
        lastEvent.setNext(complexEvent);
      }
      lastEvent=complexEvent;
    }
  }
  ComplexEventChunk<ComplexEvent> complexEventChunk=new ComplexEventChunk<ComplexEvent>();
  if (firstEvent != null) {
    complexEventChunk.add(firstEvent);
  }
  sendToCallBacks(complexEventChunk);
}

Fixed version (ground truth):
public synchronized void sendEvents(){
  ComplexEventChunk<ComplexEvent> complexEventChunk=new ComplexEventChunk<ComplexEvent>();
  for (  ComplexEvent complexEvent : groupByKeyEvents.values()) {
    complexEventChunk.add(cloneComplexEvent(complexEvent));
  }
  sendToCallBacks(complexEventChunk);
}
Program: 29133
Project: 29133
Buggy source:
@Override public Object[] currentState(){
  return new Object[]{tempGroupByKeyEvents,groupByKeyEvents};
}

Fixed version (ground truth):
@Override public Object[] currentState(){
  return new Object[]{groupByKeyEvents};
}
Program: 29134
Project: 29134
Buggy source:
@Override public void add(ComplexEvent complexEvent){
  try {
    lock.lock();
    if (endOfChunk) {
      eventChunk.clear();
      endOfChunk=false;
    }
    if (complexEvent.getType() == ComplexEvent.Type.CURRENT) {
      eventChunk.add(complexEvent);
    }
  }
  finally {
    lock.unlock();
  }
}

Fixed version (ground truth):
@Override public void add(ComplexEvent complexEvent){
  try {
    lock.lock();
    if (complexEvent.getType() == ComplexEvent.Type.CURRENT) {
      lastEvent=complexEvent;
    }
  }
  finally {
    lock.unlock();
  }
}
Program: 29135
Project: 29135
Buggy source:
@Override public void process(ComplexEventChunk complexEventChunk){
  ComplexEvent firstEvent=complexEventChunk.getFirst();
  try {
    lock.lock();
    if (firstEvent != null && firstEvent.getType() == ComplexEvent.Type.TIMER) {
      if (firstEvent.getTimestamp() >= scheduledTime) {
        sendEvents();
        scheduledTime=scheduledTime + value;
        scheduler.notifyAt(scheduledTime);
      }
    }
 else {
      endOfChunk=true;
    }
  }
  finally {
    lock.unlock();
  }
}

Fixed version (ground truth):
@Override public void process(ComplexEventChunk complexEventChunk){
  ComplexEvent firstEvent=complexEventChunk.getFirst();
  try {
    lock.lock();
    if (firstEvent != null && firstEvent.getType() == ComplexEvent.Type.TIMER) {
      if (firstEvent.getTimestamp() >= scheduledTime) {
        sendEvents();
        scheduledTime=scheduledTime + value;
        scheduler.notifyAt(scheduledTime);
      }
    }
  }
  finally {
    lock.unlock();
  }
}
Program: 29136
Project: 29136
Buggy source:
@Override public void restoreState(Object[] state){
  eventChunk=(ComplexEventChunk<ComplexEvent>)state[0];
  endOfChunk=(Boolean)state[1];
}

Fixed version (ground truth):
@Override public void restoreState(Object[] state){
  eventChunk=(ComplexEventChunk<ComplexEvent>)state[0];
}
Program: 29137
Project: 29137
Buggy source:
public synchronized void sendEvents(){
  eventChunk.reset();
  sendToCallBacks(eventChunk);
}

Fixed version (ground truth):
public synchronized void sendEvents(){
  if (lastEvent != null) {
    ComplexEventChunk<ComplexEvent> snapshotChunk=new ComplexEventChunk<ComplexEvent>();
    snapshotChunk.add(cloneComplexEvent(lastEvent));
    sendToCallBacks(snapshotChunk);
  }
}
Program: 29138
Project: 29138
Buggy source:
@Override public Object[] currentState(){
  return new Object[]{eventChunk,endOfChunk};
}

Fixed version (ground truth):
@Override public Object[] currentState(){
  return new Object[]{eventChunk};
}
Program: 29139
Project: 29139
Buggy source:
public void setStreamEventCloner(StreamEventCloner streamEventCloner){
  this.streamEventCloner=streamEventCloner;
}

Fixed version (ground truth):
public void setStreamEventCloner(StreamEventCloner streamEventCloner){
  this.streamEventCloner=streamEventCloner;
  this.receiveStreamEvent=true;
}
Program: 29140
Project: 29140
Buggy source:
public void setStateEventCloner(StateEventCloner stateEventCloner){
  this.stateEventCloner=stateEventCloner;
}

Fixed version (ground truth):
public void setStateEventCloner(StateEventCloner stateEventCloner){
  this.stateEventCloner=stateEventCloner;
  this.receiveStreamEvent=false;
}
Program: 29143
Project: 29143
Buggy source:
/** 
 * Predict the value using the feature values
 * @param data  feature values array
 * @return      predicted value
 * @throws MLModelBuilderException
 */
public double predict(double[] data) throws MLModelBuilderException {
  Predictor predictor=new Predictor(modelId,mlModel,Arrays.asList(data));
  List<?> predictions=predictor.predict();
  return (Double)predictions.get(0);
}

Fixed version (ground truth):
/** 
 * Predict the value using the feature values
 * @param data  feature values array
 * @return      predicted value
 * @throws MLModelBuilderException
 */
public String predict(String[] data) throws MLModelHandlerException {
  ArrayList<String[]> list=new ArrayList<String[]>();
  list.add(data);
  Predictor predictor=new Predictor(modelId,mlModel,list);
  List<?> predictions=predictor.predict();
  return predictions.get(0).toString();
}
Program: 29144
Project: 29144
Buggy source:
/** 
 * Retrieve the MLModel from the storage location
 * @param modelStorageLocation model storage location (file path or registry path)file: -> file path registry: -> registry path
 * @return
 * @throws URISyntaxException
 * @throws MLInputAdapterException
 * @throws IOException
 * @throws ClassNotFoundException
 */
private static MLModel retrieveModel(String modelStorageLocation) throws URISyntaxException, MLInputAdapterException, IOException, ClassNotFoundException {
  String[] modelStorage=modelStorageLocation.trim().split("String_Node_Str");
  String storageType=modelStorage[0];
  if (storageType.equals(REGISTRY_STORAGE_PREFIX)) {
    if (modelStorage[1].startsWith(PATH_TO_GOVERNANCE_REGISTRY)) {
      modelStorageLocation=modelStorage[1].substring(PATH_TO_GOVERNANCE_REGISTRY.length());
    }
 else {
      modelStorageLocation=modelStorage[1];
    }
  }
  MLIOFactory ioFactory=new MLIOFactory(MLCoreServiceValueHolder.getInstance().getMlProperties());
  MLInputAdapter inputAdapter=ioFactory.getInputAdapter(storageType + MLConstants.IN_SUFFIX);
  InputStream in=inputAdapter.readDataset(new URI(modelStorageLocation));
  ObjectInputStream ois=new ObjectInputStream(in);
  MLModel mlModel=(MLModel)ois.readObject();
  ois.close();
  return mlModel;
}

Fixed version (ground truth):
/** 
 * Retrieve the MLModel from the storage location
 * @param modelStorageLocation model storage location (file path or registry path)file: -> file path registry: -> registry path
 * @return
 * @throws URISyntaxException
 * @throws MLInputAdapterException
 * @throws IOException
 * @throws ClassNotFoundException
 */
private static MLModel retrieveModel(String modelStorageLocation) throws URISyntaxException, MLInputAdapterException, IOException, ClassNotFoundException {
  String[] modelStorage=modelStorageLocation.trim().split("String_Node_Str");
  String storageType=modelStorage[0];
  if (storageType.equals(REGISTRY_STORAGE_PREFIX)) {
    if (modelStorage[1].startsWith(PATH_TO_GOVERNANCE_REGISTRY)) {
      modelStorageLocation=modelStorage[1].substring(PATH_TO_GOVERNANCE_REGISTRY.length());
    }
 else {
      modelStorageLocation=modelStorage[1];
    }
  }
 else {
    storageType=MLConstants.DATASET_SOURCE_TYPE_FILE;
  }
  MLIOFactory ioFactory=new MLIOFactory(MLCoreServiceValueHolder.getInstance().getMlProperties());
  MLInputAdapter inputAdapter=ioFactory.getInputAdapter(storageType + MLConstants.IN_SUFFIX);
  InputStream in=inputAdapter.read(modelStorageLocation);
  ObjectInputStream ois=new ObjectInputStream(in);
  MLModel mlModel=(MLModel)ois.readObject();
  ois.close();
  return mlModel;
}
Program: 29145
Project: 29145
Buggy source:
@Override protected List<Attribute> init(AbstractDefinition inputDefinition,ExpressionExecutor[] attributeExpressionExecutors,ExecutionPlanContext executionPlanContext){
  if (attributeExpressionExecutors.length == 0) {
    throw new ExecutionPlanValidationException("String_Node_Str");
  }
 else   if (attributeExpressionExecutors.length == 1) {
    attributeSelectionAvailable=false;
  }
 else {
    attributeSelectionAvailable=true;
  }
  if (attributeExpressionExecutors[0] instanceof ConstantExpressionExecutor) {
    Object constantObj=((ConstantExpressionExecutor)attributeExpressionExecutors[0]).getValue();
    modelStorageLocation=(String)constantObj;
  }
 else {
    throw new ExecutionPlanValidationException("String_Node_Str");
  }
  return Arrays.asList(new Attribute(PREDICTION,Attribute.Type.DOUBLE));
}

Fixed version (ground truth):
@Override protected List<Attribute> init(AbstractDefinition inputDefinition,ExpressionExecutor[] attributeExpressionExecutors,ExecutionPlanContext executionPlanContext){
  if (attributeExpressionExecutors.length == 0) {
    throw new ExecutionPlanValidationException("String_Node_Str");
  }
 else   if (attributeExpressionExecutors.length == 1) {
    attributeSelectionAvailable=false;
  }
 else {
    attributeSelectionAvailable=true;
    selectedAttributesSize=attributeExpressionExecutors.length - 1;
  }
  if (attributeExpressionExecutors[0] instanceof ConstantExpressionExecutor) {
    Object constantObj=((ConstantExpressionExecutor)attributeExpressionExecutors[0]).getValue();
    modelStorageLocation=(String)constantObj;
  }
 else {
    throw new ExecutionPlanValidationException("String_Node_Str");
  }
  return Arrays.asList(new Attribute(PREDICTION,Attribute.Type.DOUBLE));
}
Program: 29146
Project: 29146
Buggy source:
@Override protected void process(ComplexEventChunk<StreamEvent> streamEventChunk,Processor nextProcessor,StreamEventCloner streamEventCloner,ComplexEventPopulater complexEventPopulater){
  StreamEvent event=streamEventChunk.getFirst();
  Object[] data;
  double[] featureValues;
  if (attributeSelectionAvailable) {
    data=event.getBeforeWindowData();
    featureValues=new double[data.length];
  }
 else {
    data=event.getOutputData();
    featureValues=new double[data.length - 1];
  }
  for (  Map.Entry<Integer,Integer> entry : attributeIndexMap.entrySet()) {
    int featureIndex=entry.getKey();
    int attributeIndex=entry.getValue();
    featureValues[featureIndex]=Double.parseDouble(String.valueOf(data[attributeIndex]));
  }
  if (featureValues != null) {
    try {
      double predictionResult=modelHandler.predict(featureValues);
      Object[] output=new Object[]{predictionResult};
      complexEventPopulater.populateComplexEvent(event,output);
      nextProcessor.process(streamEventChunk);
    }
 catch (    Exception e) {
      log.error("String_Node_Str",e);
      throw new ExecutionPlanRuntimeException("String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
@Override protected void process(ComplexEventChunk<StreamEvent> streamEventChunk,Processor nextProcessor,StreamEventCloner streamEventCloner,ComplexEventPopulater complexEventPopulater){
  while (streamEventChunk.hasNext()) {
    StreamEvent event=streamEventChunk.next();
    Object[] data;
    String[] featureValues;
    data=event.getOutputData();
    if (attributeSelectionAvailable) {
      featureValues=new String[selectedAttributesSize];
    }
 else {
      featureValues=new String[data.length - 1];
    }
    for (    Map.Entry<Integer,Integer> entry : attributeIndexMap.entrySet()) {
      int featureIndex=entry.getKey();
      int attributeIndex=entry.getValue();
      featureValues[featureIndex]=String.valueOf(data[attributeIndex]);
    }
    if (featureValues != null) {
      try {
        String predictionResult=modelHandler.predict(featureValues);
        Object[] output=new Object[]{predictionResult};
        complexEventPopulater.populateComplexEvent(event,output);
      }
 catch (      Exception e) {
        log.error("String_Node_Str",e);
        throw new ExecutionPlanRuntimeException("String_Node_Str",e);
      }
    }
  }
  nextProcessor.process(streamEventChunk);
}
Program: 29148
Project: 29148
Buggy source:
@Override public void receive(long timeStamp,Event[] inEvents,Event[] removeEvents){
  EventPrinter.print(timeStamp,inEvents,removeEvents);
  eventArrived=true;
  if (inEvents != null) {
    Assert.assertEquals(0.9176214029655854,inEvents[0].getData(0));
  }
}

Fixed version (ground truth):
@Override public void receive(long timeStamp,Event[] inEvents,Event[] removeEvents){
  EventPrinter.print(timeStamp,inEvents,removeEvents);
  eventArrived=true;
  if (inEvents != null) {
    Assert.assertEquals("String_Node_Str",inEvents[0].getData(8));
  }
}
Program: 29149
Project: 29149
Buggy source:
@Test public void predictFunctionWithSelectedAttributesTest() throws InterruptedException, URISyntaxException {
  URL resource=PredictStreamProcessorTestCase.class.getResource("String_Node_Str");
  String modelStorageLocation=new File(resource.toURI()).getAbsolutePath();
  SiddhiManager siddhiManager=new SiddhiManager();
  String inputStream="String_Node_Str" + "String_Node_Str";
  String query="String_Node_Str" + "String_Node_Str" + modelStorageLocation + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  ExecutionPlanRuntime executionPlanRuntime=siddhiManager.createExecutionPlanRuntime(inputStream + query);
  executionPlanRuntime.addCallback("String_Node_Str",new QueryCallback(){
    @Override public void receive(    long timeStamp,    Event[] inEvents,    Event[] removeEvents){
      EventPrinter.print(timeStamp,inEvents,removeEvents);
      eventArrived=true;
      if (inEvents != null) {
        Assert.assertEquals(0.9176214029655854,inEvents[0].getData(0));
      }
    }
  }
);
  InputHandler inputHandler=executionPlanRuntime.getInputHandler("String_Node_Str");
  executionPlanRuntime.start();
  inputHandler.send(new Object[]{6,148,72,35,0,33.6,0.627,50});
  Thread.sleep(1000);
  junit.framework.Assert.assertTrue(eventArrived);
  executionPlanRuntime.shutdown();
}

Fixed version (ground truth):
@Test public void predictFunctionWithSelectedAttributesTest() throws InterruptedException, URISyntaxException {
  URI resource=new URI("String_Node_Str" + System.getProperty("String_Node_Str") + "String_Node_Str");
  String modelStorageLocation=new File(resource).getAbsolutePath();
  SiddhiManager siddhiManager=new SiddhiManager();
  String inputStream="String_Node_Str" + "String_Node_Str";
  String query="String_Node_Str" + "String_Node_Str" + modelStorageLocation + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  ExecutionPlanRuntime executionPlanRuntime=siddhiManager.createExecutionPlanRuntime(inputStream + query);
  executionPlanRuntime.addCallback("String_Node_Str",new QueryCallback(){
    @Override public void receive(    long timeStamp,    Event[] inEvents,    Event[] removeEvents){
      EventPrinter.print(timeStamp,inEvents,removeEvents);
      eventArrived=true;
      if (inEvents != null) {
        Assert.assertEquals("String_Node_Str",inEvents[0].getData(8));
      }
    }
  }
);
  InputHandler inputHandler=executionPlanRuntime.getInputHandler("String_Node_Str");
  executionPlanRuntime.start();
  inputHandler.send(new Object[]{6,148,72,35,0,33.6,0.627,50});
  Thread.sleep(1000);
  junit.framework.Assert.assertTrue(eventArrived);
  executionPlanRuntime.shutdown();
}
Program: 29150
Project: 29150
Buggy source:
@Test public void predictFunctionTest() throws InterruptedException, URISyntaxException {
  URL resource=PredictStreamProcessorTestCase.class.getResource("String_Node_Str");
  String modelStorageLocation=new File(resource.toURI()).getAbsolutePath();
  SiddhiManager siddhiManager=new SiddhiManager();
  String inputStream="String_Node_Str" + "String_Node_Str";
  String query="String_Node_Str" + "String_Node_Str" + modelStorageLocation + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  ExecutionPlanRuntime executionPlanRuntime=siddhiManager.createExecutionPlanRuntime(inputStream + query);
  executionPlanRuntime.addCallback("String_Node_Str",new QueryCallback(){
    @Override public void receive(    long timeStamp,    Event[] inEvents,    Event[] removeEvents){
      EventPrinter.print(timeStamp,inEvents,removeEvents);
      eventArrived=true;
      if (inEvents != null) {
        Assert.assertEquals(0.9176214029655854,inEvents[0].getData(8));
      }
    }
  }
);
  InputHandler inputHandler=executionPlanRuntime.getInputHandler("String_Node_Str");
  executionPlanRuntime.start();
  inputHandler.send(new Object[]{6,148,72,35,0,33.6,0.627,50});
  Thread.sleep(1000);
  junit.framework.Assert.assertTrue(eventArrived);
  executionPlanRuntime.shutdown();
}

Fixed version (ground truth):
@Test public void predictFunctionTest() throws InterruptedException, URISyntaxException {
  URI resource=new URI("String_Node_Str" + System.getProperty("String_Node_Str") + "String_Node_Str");
  String modelStorageLocation=new File(resource).getAbsolutePath();
  SiddhiManager siddhiManager=new SiddhiManager();
  String inputStream="String_Node_Str" + "String_Node_Str";
  String query="String_Node_Str" + "String_Node_Str" + modelStorageLocation + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  ExecutionPlanRuntime executionPlanRuntime=siddhiManager.createExecutionPlanRuntime(inputStream + query);
  executionPlanRuntime.addCallback("String_Node_Str",new QueryCallback(){
    @Override public void receive(    long timeStamp,    Event[] inEvents,    Event[] removeEvents){
      EventPrinter.print(timeStamp,inEvents,removeEvents);
      eventArrived=true;
      if (inEvents != null) {
        Assert.assertEquals("String_Node_Str",String.valueOf(inEvents[0].getData(8)));
      }
    }
  }
);
  InputHandler inputHandler=executionPlanRuntime.getInputHandler("String_Node_Str");
  executionPlanRuntime.start();
  inputHandler.send(new Object[]{6,148,72,35,0,33.6,0.627,50});
  Thread.sleep(1000);
  junit.framework.Assert.assertTrue(eventArrived);
  executionPlanRuntime.shutdown();
  siddhiManager.shutdown();
}
Program: 29152
Project: 29152
Buggy source:
/** 
 * Helper method to load the siddhi extensions
 */
public static Map<String,Class> loadSiddhiExtensions(){
  String classPath=System.getProperty(CLASS_PATH,"String_Node_Str");
  if (classPath == null) {
    classPath="String_Node_Str";
  }
 else {
    classPath+="String_Node_Str";
  }
  String[] classPathElements=classPath.split("String_Node_Str");
  Pattern pattern=Pattern.compile(SIDDHI_EXT);
  Collection<String> extensionsList=new ArrayList<String>();
  for (  String element : classPathElements) {
    extensionsList.addAll(getResources(element,pattern));
  }
  Map<String,Class> classMap=new HashMap<String,Class>();
  for (  String extension : extensionsList) {
    if (extension.matches(CLASS_EXT)) {
      String[] info=extension.split("String_Node_Str");
      try {
        classMap.put(info[0].trim(),Class.forName(info[1].trim()));
      }
 catch (      ClassNotFoundException e) {
        log.error("String_Node_Str" + info[1].trim(),e);
      }
    }
  }
  return classMap;
}

Fixed version (ground truth):
/** 
 * Helper method to load the siddhi extensions
 */
public static Map<String,Class> loadSiddhiExtensions(){
  String classPath=System.getProperty(CLASS_PATH);
  if (classPath == null) {
    classPath="String_Node_Str";
  }
 else {
    classPath+="String_Node_Str";
  }
  String[] classPathElements=classPath.split("String_Node_Str");
  Pattern pattern=Pattern.compile(SIDDHI_EXT);
  Collection<String> extensionsList=new ArrayList<String>();
  for (  String element : classPathElements) {
    extensionsList.addAll(getResources(element,pattern));
  }
  Map<String,Class> classMap=new HashMap<String,Class>();
  for (  String extension : extensionsList) {
    if (extension.matches(CLASS_EXT)) {
      String[] info=extension.split("String_Node_Str");
      try {
        classMap.put(info[0].trim(),Class.forName(info[1].trim()));
      }
 catch (      ClassNotFoundException e) {
        log.debug("String_Node_Str" + extension);
      }
    }
  }
  return classMap;
}
Program: 29153
Project: 29153
Buggy source:
/** 
 * Helper method to load the siddhi extensions
 */
public static Map<String,Class> loadSiddhiExtensions(){
  String classPath=System.getProperty(CLASS_PATH,"String_Node_Str");
  String[] classPathElements=classPath.split("String_Node_Str");
  Pattern pattern=Pattern.compile(SIDDHI_EXT);
  Collection<String> extensionsList=new ArrayList<String>();
  for (  String element : classPathElements) {
    extensionsList.addAll(getResources(element,pattern));
  }
  Map<String,Class> classMap=new HashMap<String,Class>();
  for (  String extension : extensionsList) {
    if (extension.matches(CLASS_EXT)) {
      String[] info=extension.split("String_Node_Str");
      try {
        classMap.put(info[0].trim(),Class.forName(info[1].trim()));
      }
 catch (      ClassNotFoundException e) {
        log.error("String_Node_Str" + info[1].trim(),e);
      }
    }
  }
  return classMap;
}

Fixed version (ground truth):
/** 
 * Helper method to load the siddhi extensions
 */
public static Map<String,Class> loadSiddhiExtensions(){
  String classPath=System.getProperty(CLASS_PATH,"String_Node_Str");
  if (classPath == null) {
    classPath="String_Node_Str";
  }
 else {
    classPath+="String_Node_Str";
  }
  String[] classPathElements=classPath.split("String_Node_Str");
  Pattern pattern=Pattern.compile(SIDDHI_EXT);
  Collection<String> extensionsList=new ArrayList<String>();
  for (  String element : classPathElements) {
    extensionsList.addAll(getResources(element,pattern));
  }
  Map<String,Class> classMap=new HashMap<String,Class>();
  for (  String extension : extensionsList) {
    if (extension.matches(CLASS_EXT)) {
      String[] info=extension.split("String_Node_Str");
      try {
        classMap.put(info[0].trim(),Class.forName(info[1].trim()));
      }
 catch (      ClassNotFoundException e) {
        log.error("String_Node_Str" + info[1].trim(),e);
      }
    }
  }
  return classMap;
}
Program: 29155
Project: 29155
Buggy source:
@Override public void receive(Event[] events){
  EventPrinter.print(events);
  for (  Event event : events) {
    if (event.isExpired()) {
      removeEventCount++;
      Assert.assertEquals("String_Node_Str",removeEventCount,event.getData(2));
      if (removeEventCount == 1) {
        Assert.assertEquals("String_Node_Str",length,inEventCount);
      }
    }
 else {
      inEventCount++;
      Assert.assertEquals("String_Node_Str",inEventCount,event.getData(2));
    }
  }
  Assert.assertEquals("String_Node_Str",inEventCount - length,removeEventCount);
  eventArrived=true;
}

Fixed version (ground truth):
@Override public void receive(Event[] events){
  EventPrinter.print(events);
  for (  Event event : events) {
    if (event.isExpired()) {
      removeEventCount++;
      Assert.assertEquals("String_Node_Str",removeEventCount,event.getData(2));
    }
 else {
      inEventCount++;
      Assert.fail("String_Node_Str");
    }
  }
  eventArrived=true;
}
Program: 29156
Project: 29156
Buggy source:
/** 
 * {@inheritDoc}<p/> <p>The default implementation returns the result of calling  {@link #visitChildren} on {@code ctx}.</p>
 * @param ctx
 */
@Override public OutputStream.OutputEventType visitOutput_event_type(@NotNull SiddhiQLParser.Output_event_typeContext ctx){
  if (ctx.ALL() != null) {
    if (ctx.RAW() != null) {
      return OutputStream.OutputEventType.ALL_RAW_EVENTS;
    }
 else {
      return OutputStream.OutputEventType.ALL_EVENTS;
    }
  }
 else   if (ctx.EXPIRED() != null) {
    if (ctx.RAW() != null) {
      return OutputStream.OutputEventType.EXPIRED_EVENTS;
    }
 else {
      return OutputStream.OutputEventType.EXPIRED_RAW_EVENTS;
    }
  }
 else {
    return OutputStream.OutputEventType.CURRENT_EVENTS;
  }
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}<p/> <p>The default implementation returns the result of calling  {@link #visitChildren} on {@code ctx}.</p>
 * @param ctx
 */
@Override public OutputStream.OutputEventType visitOutput_event_type(@NotNull SiddhiQLParser.Output_event_typeContext ctx){
  if (ctx.ALL() != null) {
    if (ctx.RAW() != null) {
      return OutputStream.OutputEventType.ALL_RAW_EVENTS;
    }
 else {
      return OutputStream.OutputEventType.ALL_EVENTS;
    }
  }
 else   if (ctx.EXPIRED() != null) {
    if (ctx.RAW() != null) {
      return OutputStream.OutputEventType.EXPIRED_RAW_EVENTS;
    }
 else {
      return OutputStream.OutputEventType.EXPIRED_EVENTS;
    }
  }
 else {
    return OutputStream.OutputEventType.CURRENT_EVENTS;
  }
}
Program: 29157
Project: 29157
Buggy source:
private void send(long timeStamp,Event[] currentEvents,Event[] expiredEvents){
  receive(timeStamp,currentEvents,expiredEvents);
}

Fixed version (ground truth):
private void send(long timeStamp,Event[] currentEvents,Event[] expiredEvents){
  try {
    receive(timeStamp,currentEvents,expiredEvents);
  }
 catch (  RuntimeException e) {
    log.error("String_Node_Str" + Arrays.deepToString(currentEvents) + "String_Node_Str"+ Arrays.deepToString(expiredEvents),e);
  }
}
Program: 29158
Project: 29158
Buggy source:
@Override protected void init(ExpressionExecutor[] attributeExpressionExecutors,ExecutionPlanContext executionPlanContext){
  this.executionPlanContext=executionPlanContext;
  expiredEventChunk=new ComplexEventChunk<StreamEvent>();
  if (attributeExpressionExecutors != null) {
    timeInMilliSeconds=(Long)((ConstantExpressionExecutor)attributeExpressionExecutors[0]).getValue();
  }
}

Fixed version (ground truth):
@Override protected void init(ExpressionExecutor[] attributeExpressionExecutors,ExecutionPlanContext executionPlanContext){
  this.executionPlanContext=executionPlanContext;
  this.expiredEventChunk=new ComplexEventChunk<StreamEvent>();
  if (attributeExpressionExecutors.length == 1) {
    if (attributeExpressionExecutors[0] instanceof ConstantExpressionExecutor) {
      if (attributeExpressionExecutors[0].getReturnType() == Attribute.Type.INT) {
        timeInMilliSeconds=(Integer)((ConstantExpressionExecutor)attributeExpressionExecutors[0]).getValue();
      }
 else       if (attributeExpressionExecutors[0].getReturnType() == Attribute.Type.LONG) {
        timeInMilliSeconds=(Long)((ConstantExpressionExecutor)attributeExpressionExecutors[0]).getValue();
      }
 else {
        throw new ExecutionPlanValidationException("String_Node_Str" + attributeExpressionExecutors[0].getReturnType());
      }
    }
 else {
      throw new ExecutionPlanValidationException("String_Node_Str" + attributeExpressionExecutors[0].getClass().getCanonicalName());
    }
  }
 else {
    throw new ExecutionPlanValidationException("String_Node_Str" + attributeExpressionExecutors.length + "String_Node_Str");
  }
}
Program: 29159
Project: 29159
Buggy source:
@Override protected void process(ComplexEventChunk<StreamEvent> streamEventChunk,Processor nextProcessor,StreamEventCloner streamEventCloner){
  while (streamEventChunk.hasNext()) {
    StreamEvent streamEvent=streamEventChunk.next();
    long currentTime=executionPlanContext.getTimestampGenerator().currentTime();
    StreamEvent clonedEvent=null;
    if (streamEvent.getType() == StreamEvent.Type.CURRENT) {
      clonedEvent=streamEventCloner.copyStreamEvent(streamEvent);
      clonedEvent.setType(StreamEvent.Type.EXPIRED);
      clonedEvent.setTimestamp(currentTime + timeInMilliSeconds);
    }
    while (expiredEventChunk.hasNext()) {
      StreamEvent expiredEvent=expiredEventChunk.next();
      long timeDiff=expiredEvent.getTimestamp() - currentTime;
      if (timeDiff <= 0) {
        expiredEventChunk.remove();
        streamEventChunk.insertBeforeCurrent(expiredEvent);
      }
 else {
        scheduler.notifyAt(expiredEvent.getTimestamp());
        expiredEventChunk.reset();
        break;
      }
    }
    if (streamEvent.getType() == StreamEvent.Type.CURRENT) {
      this.expiredEventChunk.add(clonedEvent);
    }
    expiredEventChunk.reset();
  }
  nextProcessor.process(streamEventChunk);
}

Fixed version (ground truth):
@Override protected void process(ComplexEventChunk<StreamEvent> streamEventChunk,Processor nextProcessor,StreamEventCloner streamEventCloner){
  while (streamEventChunk.hasNext()) {
    StreamEvent streamEvent=streamEventChunk.next();
    long currentTime=executionPlanContext.getTimestampGenerator().currentTime();
    StreamEvent clonedEvent=null;
    if (streamEvent.getType() == StreamEvent.Type.CURRENT) {
      clonedEvent=streamEventCloner.copyStreamEvent(streamEvent);
      clonedEvent.setType(StreamEvent.Type.EXPIRED);
      clonedEvent.setTimestamp(currentTime + timeInMilliSeconds);
    }
    boolean eventScheduled=false;
    while (expiredEventChunk.hasNext()) {
      StreamEvent expiredEvent=expiredEventChunk.next();
      long timeDiff=expiredEvent.getTimestamp() - currentTime;
      if (timeDiff <= 0) {
        expiredEventChunk.remove();
        streamEventChunk.insertBeforeCurrent(expiredEvent);
      }
 else {
        scheduler.notifyAt(expiredEvent.getTimestamp());
        expiredEventChunk.reset();
        eventScheduled=true;
        break;
      }
    }
    if (streamEvent.getType() == StreamEvent.Type.CURRENT) {
      this.expiredEventChunk.add(clonedEvent);
      if (!eventScheduled) {
        scheduler.notifyAt(clonedEvent.getTimestamp());
      }
    }
    expiredEventChunk.reset();
  }
  nextProcessor.process(streamEventChunk);
}
Program: 29160
Project: 29160
Buggy source:
@Override public void process(ComplexEventChunk complexEventChunk){
  complexEventChunk.reset();
  if (log.isTraceEnabled()) {
    log.trace("String_Node_Str" + id + this);
  }
  while (complexEventChunk.hasNext()) {
    ComplexEvent event=complexEventChunk.next();
    eventPopulator.populateStateEvent(event);
    if (event.getType() == StreamEvent.Type.CURRENT || event.getType() == StreamEvent.Type.EXPIRED) {
      if (isGroupBy) {
        keyThreadLocal.set(groupByKeyGenerator.constructEventKey(event));
      }
      for (      AttributeProcessor attributeProcessor : attributeProcessorList) {
        attributeProcessor.process(event);
      }
      if (isGroupBy) {
        keyThreadLocal.remove();
      }
      if (havingConditionExecutor != null && !havingConditionExecutor.execute(event)) {
        complexEventChunk.remove();
      }
    }
 else {
      complexEventChunk.remove();
    }
  }
  if (complexEventChunk.getFirst() != null) {
    outputRateLimiter.process(complexEventChunk);
  }
}

Fixed version (ground truth):
@Override public void process(ComplexEventChunk complexEventChunk){
  complexEventChunk.reset();
  if (log.isTraceEnabled()) {
    log.trace("String_Node_Str" + id + this);
  }
  while (complexEventChunk.hasNext()) {
    ComplexEvent event=complexEventChunk.next();
    if (event.getType() == StreamEvent.Type.CURRENT || event.getType() == StreamEvent.Type.EXPIRED) {
      eventPopulator.populateStateEvent(event);
      if (isGroupBy) {
        keyThreadLocal.set(groupByKeyGenerator.constructEventKey(event));
      }
      for (      AttributeProcessor attributeProcessor : attributeProcessorList) {
        attributeProcessor.process(event);
      }
      if (isGroupBy) {
        keyThreadLocal.remove();
      }
      if (havingConditionExecutor != null && !havingConditionExecutor.execute(event)) {
        complexEventChunk.remove();
      }
    }
 else {
      complexEventChunk.remove();
    }
  }
  if (complexEventChunk.getFirst() != null) {
    outputRateLimiter.process(complexEventChunk);
  }
}
Program: 29161
Project: 29161
Buggy source:
@Before public void init(){
  inEventCount=0;
  removeEventCount=0;
  eventArrived=false;
}

Fixed version (ground truth):
@Before public void init(){
  inEventCount=0;
  removeEventCount=0;
  eventArrived=false;
  firstEvent=true;
}
Program: 29162
Project: 29162
Buggy source:
@Override public void receive(Event[] events){
  EventPrinter.print(events);
  for (  Event event : events) {
    if (event.isExpired()) {
      removeEventCount++;
      if (removeEventCount == 1) {
        Assert.assertEquals(100.0,event.getData()[1]);
      }
 else       if (removeEventCount == 2 || removeEventCount == 3) {
        Assert.assertEquals(0.0,event.getData()[1]);
      }
    }
 else {
      inEventCount++;
      if (inEventCount == 1) {
        Assert.assertEquals(70.0,event.getData()[1]);
      }
 else       if (inEventCount == 2) {
        Assert.assertEquals(700.0,event.getData()[1]);
      }
 else       if (inEventCount == 3) {
        Assert.assertEquals(170.0,event.getData()[1]);
      }
 else       if (inEventCount == 4) {
        Assert.assertEquals(200.0,event.getData()[1]);
      }
 else       if (inEventCount == 5) {
        Assert.assertEquals(1000.0,event.getData()[1]);
      }
    }
    eventArrived=true;
  }
}

Fixed version (ground truth):
@Override public void receive(Event[] events){
  EventPrinter.print(events);
  for (  Event event : events) {
    if (event.isExpired()) {
      removeEventCount++;
      if ("String_Node_Str".equals(event.getData()[0]) && firstEvent) {
        firstEvent=false;
        Assert.assertEquals(100.0,event.getData()[1]);
      }
 else {
        Assert.assertEquals(0.0,event.getData()[1]);
      }
    }
 else {
      inEventCount++;
      if (inEventCount == 1) {
        Assert.assertEquals(70.0,event.getData()[1]);
      }
 else       if (inEventCount == 2) {
        Assert.assertEquals(700.0,event.getData()[1]);
      }
 else       if (inEventCount == 3) {
        Assert.assertEquals(170.0,event.getData()[1]);
      }
 else       if (inEventCount == 4) {
        Assert.assertEquals(200.0,event.getData()[1]);
      }
 else       if (inEventCount == 5) {
        Assert.assertEquals(1000.0,event.getData()[1]);
      }
    }
    eventArrived=true;
  }
}
Program: 29164
Project: 29164
Buggy source:
@Override public void receive(long timeStamp,Event[] inEvents,Event[] removeEvents){
  EventPrinter.print(timeStamp,inEvents,removeEvents);
  if (inEvents != null) {
    for (    Event event : inEvents) {
      inEventCount++;
switch (inEventCount) {
case 1:
        Assert.assertArrayEquals(new Object[]{"String_Node_Str","String_Node_Str",75.6f},event.getData());
      break;
default :
    Assert.assertSame(1,inEventCount);
}
}
eventArrived=true;
}
if (removeEvents != null) {
removeEventCount=removeEventCount + removeEvents.length;
}
eventArrived=true;
}

Fixed version (ground truth):
@Override public void receive(long timeStamp,Event[] inEvents,Event[] removeEvents){
  EventPrinter.print(timeStamp,inEvents,removeEvents);
  if (inEvents != null) {
    for (    Event event : inEvents) {
      inEventCount++;
switch (inEventCount) {
case 1:
        Assert.assertArrayEquals(new Object[]{"String_Node_Str","String_Node_Str",75.6f},event.getData());
      break;
default :
    Assert.assertSame(1,inEventCount);
}
}
}
if (removeEvents != null) {
for (Event event : removeEvents) {
removeEventCount++;
switch (removeEventCount) {
case 1:
  Assert.assertArrayEquals(new Object[]{"String_Node_Str","String_Node_Str",75.6f},event.getData());
break;
default :
Assert.assertSame(1,removeEventCount);
}
}
}
eventArrived=true;
}
Program: 29166
Project: 29166
Buggy source:
private void sendEvents(){
  try {
    int size=eventBuffer.size();
switch (size) {
case 0:
{
        return;
      }
case 1:
{
      inputProcessor.send(eventBuffer.get(0),currentIndex);
      eventBuffer.clear();
      return;
    }
default :
{
    inputProcessor.send(eventBuffer.toArray(new Event[size]),currentIndex);
    eventBuffer.clear();
  }
}
}
 catch (Throwable t) {
t.printStackTrace();
}
}

Fixed version (ground truth):
private void sendEvents(){
  int size=eventBuffer.size();
switch (size) {
case 0:
{
      return;
    }
case 1:
{
    inputProcessor.send(eventBuffer.get(0),currentIndex);
    eventBuffer.clear();
    return;
  }
default :
{
  inputProcessor.send(eventBuffer.toArray(new Event[size]),currentIndex);
  eventBuffer.clear();
}
}
}
Program: 29167
Project: 29167
Buggy source:
public SiddhiManager(){
  siddhiContext=new SiddhiContext();
  siddhiContext.setEventBufferSize(SiddhiConstants.DEFAULT_EVENT_BUFFER_SIZE);
}

Fixed version (ground truth):
public SiddhiManager(){
  siddhiContext=new SiddhiContext();
}
Program: 29168
Project: 29168
Buggy source:
public SiddhiContext(){
  setSiddhiExtensions(SiddhiExtensionLoader.loadSiddhiExtensions());
}

Fixed version (ground truth):
public SiddhiContext(){
  setSiddhiExtensions(SiddhiExtensionLoader.loadSiddhiExtensions());
  eventBufferSize=SiddhiConstants.DEFAULT_EVENT_BUFFER_SIZE;
}
Program: 29170
Project: 29170
Buggy source:
public PersistenceService(SiddhiContext siddhiContext){
  this.queryPlanIdentifier=siddhiContext.getQueryPlanIdentifier();
  this.siddhiContext=siddhiContext;
}

Fixed version (ground truth):
public PersistenceService(ExecutionPlanContext executionPlanContext){
  this.snapshotService=executionPlanContext.getSnapshotService();
  this.persistenceStore=executionPlanContext.getSiddhiContext().getPersistenceStore();
  this.executionPlanName=executionPlanContext.getName();
  this.sharedLock=executionPlanContext.getSharedLock();
}
Program: 29171
Project: 29171
Buggy source:
public void restoreRevision(String revision){
  if (persistenceStore != null) {
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + revision + "String_Node_Str");
    }
    byte[] snapshot=persistenceStore.load(queryPlanIdentifier,revision);
    siddhiContext.getSnapshotService().restore(snapshot);
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + revision);
    }
  }
 else {
    throw new NoPersistenceStoreAssignedException("String_Node_Str" + queryPlanIdentifier);
  }
}

Fixed version (ground truth):
public void restoreRevision(String revision){
  if (persistenceStore != null) {
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + revision + "String_Node_Str");
    }
    byte[] snapshot=persistenceStore.load(executionPlanName,revision);
    snapshotService.restore(snapshot);
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str" + revision);
    }
  }
 else {
    throw new NoPersistenceStoreException("String_Node_Str" + executionPlanName);
  }
}
Program: 29172
Project: 29172
Buggy source:
public String persist(){
  if (persistenceStore != null) {
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str");
    }
    byte[] snapshot=siddhiContext.getSnapshotService().snapshot();
    String revision=System.currentTimeMillis() + "String_Node_Str" + queryPlanIdentifier;
    persistenceStore.save(queryPlanIdentifier,revision,snapshot);
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str");
    }
    return revision;
  }
 else {
    throw new NoPersistenceStoreAssignedException("String_Node_Str" + queryPlanIdentifier);
  }
}

Fixed version (ground truth):
public String persist(){
  if (persistenceStore != null) {
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str");
    }
    byte[] snapshot=snapshotService.snapshot();
    String revision=System.currentTimeMillis() + "String_Node_Str" + executionPlanName;
    persistenceStore.save(executionPlanName,revision,snapshot);
    if (log.isDebugEnabled()) {
      log.debug("String_Node_Str");
    }
    return revision;
  }
 else {
    throw new NoPersistenceStoreException("String_Node_Str" + executionPlanName);
  }
}
Program: 29173
Project: 29173
Buggy source:
public void restoreLastRevision(){
  try {
    this.siddhiContext.getThreadBarrier().close();
    if (persistenceStore != null) {
      String revision=persistenceStore.getLastRevision(queryPlanIdentifier);
      if (revision != null) {
        restoreRevision(revision);
      }
    }
 else {
      throw new NoPersistenceStoreAssignedException("String_Node_Str" + queryPlanIdentifier);
    }
  }
  finally {
    siddhiContext.getThreadBarrier().open();
  }
}

Fixed version (ground truth):
public void restoreLastRevision(){
  try {
    this.sharedLock.lock();
    if (persistenceStore != null) {
      String revision=persistenceStore.getLastRevision(executionPlanName);
      if (revision != null) {
        restoreRevision(revision);
      }
    }
 else {
      throw new NoPersistenceStoreException("String_Node_Str" + executionPlanName);
    }
  }
  finally {
    sharedLock.unlock();
  }
}
Program: 29174
Project: 29174
Buggy source:
public SnapshotService(SiddhiContext siddhiContext){
  this.siddhiContext=siddhiContext;
}

Fixed version (ground truth):
public SnapshotService(ExecutionPlanContext executionPlanContext){
  this.executionPlanContext=executionPlanContext;
}
Program: 29175
Project: 29175
Buggy source:
public void restore(byte[] snapshot){
  HashMap<String,SnapshotObject> snapshots=(HashMap<String,SnapshotObject>)ByteSerializer.BToO(snapshot);
  try {
    this.siddhiContext.getThreadBarrier().close();
    for (    Snapshotable snapshotable : snapshotableList) {
      snapshotable.restore(snapshots.get(snapshotable.getElementId()));
    }
  }
  finally {
    siddhiContext.getThreadBarrier().open();
  }
}

Fixed version (ground truth):
public void restore(byte[] snapshot){
  HashMap<String,SnapshotObject> snapshots=(HashMap<String,SnapshotObject>)ByteSerializer.BToO(snapshot);
  try {
    this.executionPlanContext.getSharedLock().lock();
    for (    Snapshotable snapshotable : snapshotableList) {
      snapshotable.restore(snapshots.get(snapshotable.getElementId()));
    }
  }
  finally {
    executionPlanContext.getSharedLock().unlock();
  }
}
Program: 29176
Project: 29176
Buggy source:
public byte[] snapshot(){
  HashMap<String,SnapshotObject> snapshots=new HashMap<String,SnapshotObject>(snapshotableList.size());
  if (log.isDebugEnabled()) {
    log.debug("String_Node_Str");
  }
  try {
    siddhiContext.getThreadBarrier().close();
    for (    Snapshotable snapshotable : snapshotableList) {
      snapshots.put(snapshotable.getElementId(),snapshotable.snapshot());
    }
  }
  finally {
    siddhiContext.getThreadBarrier().open();
  }
  if (log.isDebugEnabled()) {
    log.debug("String_Node_Str");
  }
  return ByteSerializer.OToB(snapshots);
}

Fixed version (ground truth):
public byte[] snapshot(){
  HashMap<String,SnapshotObject> snapshots=new HashMap<String,SnapshotObject>(snapshotableList.size());
  if (log.isDebugEnabled()) {
    log.debug("String_Node_Str");
  }
  try {
    executionPlanContext.getSharedLock().lock();
    for (    Snapshotable snapshotable : snapshotableList) {
      snapshots.put(snapshotable.getElementId(),snapshotable.snapshot());
    }
  }
  finally {
    executionPlanContext.getSharedLock().unlock();
  }
  if (log.isDebugEnabled()) {
    log.debug("String_Node_Str");
  }
  return ByteSerializer.OToB(snapshots);
}
Program: 29177
Project: 29177
Buggy source:
@Test public void timeWindowTest1() throws InterruptedException {
  SiddhiManager siddhiManager=new SiddhiManager();
  String cseEventStream="String_Node_Str";
  String query="String_Node_Str" + "String_Node_Str";
  ExecutionPlanRuntime executionPlanRuntime=siddhiManager.createExecutionPlanRuntime(cseEventStream + query);
  executionPlanRuntime.addCallback("String_Node_Str",new QueryCallback(){
    @Override public void receive(    long timeStamp,    Event[] inEvents,    Event[] removeEvents){
      EventPrinter.print(timeStamp,inEvents,removeEvents);
      if (inEvents != null) {
        inEventCount=inEventCount + inEvents.length;
      }
      if (removeEvents != null) {
        Assert.assertEquals("String_Node_Str",inEventCount - 2,removeEventCount);
        removeEventCount=removeEventCount + removeEvents.length;
      }
      eventArrived=true;
    }
  }
);
  InputHandler inputHandler=executionPlanRuntime.getInputHandler("String_Node_Str");
  executionPlanRuntime.start();
  inputHandler.send(new Object[]{"String_Node_Str",700f,0});
  inputHandler.send(new Object[]{"String_Node_Str",60.5f,1});
  Thread.sleep(5000);
  Assert.assertEquals(2,inEventCount);
  Assert.assertEquals(2,removeEventCount);
  Assert.assertTrue(eventArrived);
  executionPlanRuntime.shutdown();
}

Fixed version (ground truth):
@Test public void timeWindowTest1() throws InterruptedException {
  SiddhiManager siddhiManager=new SiddhiManager();
  String cseEventStream="String_Node_Str" + "String_Node_Str";
  String query="String_Node_Str" + "String_Node_Str" + "String_Node_Str"+ "String_Node_Str"+ "String_Node_Str";
  ExecutionPlanRuntime executionPlanRuntime=siddhiManager.createExecutionPlanRuntime(cseEventStream + query);
  executionPlanRuntime.addCallback("String_Node_Str",new QueryCallback(){
    @Override public void receive(    long timeStamp,    Event[] inEvents,    Event[] removeEvents){
      EventPrinter.print(timeStamp,inEvents,removeEvents);
      if (inEvents != null) {
        inEventCount=inEventCount + inEvents.length;
      }
      if (removeEvents != null) {
        Assert.assertEquals("String_Node_Str",inEventCount - 2,removeEventCount);
        removeEventCount=removeEventCount + removeEvents.length;
      }
      eventArrived=true;
    }
  }
);
  InputHandler inputHandler=executionPlanRuntime.getInputHandler("String_Node_Str");
  executionPlanRuntime.start();
  inputHandler.send(new Object[]{"String_Node_Str",700f,0});
  inputHandler.send(new Object[]{"String_Node_Str",60.5f,1});
  Thread.sleep(5000);
  Assert.assertEquals(2,inEventCount);
  Assert.assertEquals(2,removeEventCount);
  Assert.assertTrue(eventArrived);
  executionPlanRuntime.shutdown();
}
Program: 29178
Project: 29178
Buggy source:
@Override public ExpressionExecutor cloneExecutor(){
  return this;
}

Fixed version (ground truth):
@Override public ExpressionExecutor cloneExecutor(String key){
  return this;
}