Program: 29169
Project: 29169
Buggy source:
/** 
 * Parse an ExecutionPlan returning ExecutionPlanRuntime
 * @param executionPlan plan to be parsed
 * @return ExecutionPlanRuntime
 */
public static ExecutionPlanRuntime parse(ExecutionPlan executionPlan,SiddhiContext siddhiContext){
  ExecutionPlanContext executionPlanContext=new ExecutionPlanContext();
  executionPlanContext.setSiddhiContext(siddhiContext);
  try {
    Element element=AnnotationHelper.getAnnotationElement(SiddhiConstants.ANNOTATION_NAME,null,executionPlan.getAnnotations());
    if (element != null) {
      executionPlanContext.setName(element.getValue());
    }
 else {
      executionPlanContext.setName(UUID.randomUUID().toString());
    }
    Annotation annotation=AnnotationHelper.getAnnotation(SiddhiConstants.ANNOTATION_PLAYBACK,executionPlan.getAnnotations());
    if (annotation != null) {
      executionPlanContext.setPlayback(true);
    }
    annotation=AnnotationHelper.getAnnotation(SiddhiConstants.ANNOTATION_ENFORCE_ORDER,executionPlan.getAnnotations());
    if (annotation != null) {
      executionPlanContext.setEnforceOrder(true);
    }
    annotation=AnnotationHelper.getAnnotation(SiddhiConstants.ANNOTATION_PARALLEL,executionPlan.getAnnotations());
    if (annotation != null) {
      executionPlanContext.setParallel(true);
    }
    if (!executionPlanContext.isPlayback() && !executionPlanContext.isEnforceOrder() && !executionPlanContext.isParallel()) {
      executionPlanContext.setSharedLock(new ReentrantLock());
    }
    executionPlanContext.setExecutorService(new ThreadPoolExecutor(5,Integer.MAX_VALUE,60L,TimeUnit.SECONDS,new LinkedBlockingDeque<Runnable>()));
    executionPlanContext.setScheduledExecutorService(Executors.newScheduledThreadPool(5));
    executionPlanContext.setTimestampGenerator(new SystemCurrentTimeMillisTimestampGenerator());
  }
 catch (  DuplicateAnnotationException e) {
    throw new DuplicateAnnotationException(e.getMessage() + "String_Node_Str" + executionPlan.toString());
  }
  ExecutionPlanRuntime executionPlanRuntime=new ExecutionPlanRuntime(executionPlanContext);
  defineStreamDefinitions(executionPlanRuntime,executionPlan.getStreamDefinitionMap());
  defineTableDefinitions(executionPlanRuntime,executionPlan.getTableDefinitionMap());
  try {
    for (    ExecutionElement executionElement : executionPlan.getExecutionElementList()) {
      if (executionElement instanceof Query) {
        QueryRuntime queryRuntime=QueryParser.parse((Query)executionElement,executionPlanContext,executionPlanRuntime.getStreamDefinitionMap(),executionPlanRuntime.getTableDefinitionMap(),executionPlanRuntime.getEventTableMap());
        executionPlanRuntime.addQuery(queryRuntime);
      }
 else {
        PartitionRuntime partitionRuntime=PartitionParser.parse(executionPlanRuntime,(Partition)executionElement,executionPlanContext,executionPlanRuntime.getStreamDefinitionMap());
        executionPlanRuntime.addPartition(partitionRuntime);
      }
    }
  }
 catch (  ExecutionPlanCreationException e) {
    throw new ExecutionPlanValidationException(e.getMessage() + "String_Node_Str" + executionPlanRuntime.getName()+ "String_Node_Str",e);
  }
catch (  DuplicateDefinitionException e) {
    throw new DuplicateDefinitionException(e.getMessage() + "String_Node_Str" + executionPlanRuntime.getName()+ "String_Node_Str",e);
  }
  return executionPlanRuntime;
}

Fixed version (ground truth):
/** 
 * Parse an ExecutionPlan returning ExecutionPlanRuntime
 * @param executionPlan plan to be parsed
 * @return ExecutionPlanRuntime
 */
public static ExecutionPlanRuntime parse(ExecutionPlan executionPlan,SiddhiContext siddhiContext){
  ExecutionPlanContext executionPlanContext=new ExecutionPlanContext();
  executionPlanContext.setSiddhiContext(siddhiContext);
  try {
    Element element=AnnotationHelper.getAnnotationElement(SiddhiConstants.ANNOTATION_NAME,null,executionPlan.getAnnotations());
    if (element != null) {
      executionPlanContext.setName(element.getValue());
    }
 else {
      executionPlanContext.setName(UUID.randomUUID().toString());
    }
    Annotation annotation=AnnotationHelper.getAnnotation(SiddhiConstants.ANNOTATION_PLAYBACK,executionPlan.getAnnotations());
    if (annotation != null) {
      executionPlanContext.setPlayback(true);
    }
    annotation=AnnotationHelper.getAnnotation(SiddhiConstants.ANNOTATION_ENFORCE_ORDER,executionPlan.getAnnotations());
    if (annotation != null) {
      executionPlanContext.setEnforceOrder(true);
    }
    annotation=AnnotationHelper.getAnnotation(SiddhiConstants.ANNOTATION_PARALLEL,executionPlan.getAnnotations());
    if (annotation != null) {
      executionPlanContext.setParallel(true);
    }
    if (!executionPlanContext.isPlayback() && !executionPlanContext.isEnforceOrder() && !executionPlanContext.isParallel()) {
      executionPlanContext.setSharedLock(new ReentrantLock());
    }
    executionPlanContext.setExecutorService(new ThreadPoolExecutor(5,Integer.MAX_VALUE,60L,TimeUnit.SECONDS,new LinkedBlockingDeque<Runnable>()));
    executionPlanContext.setScheduledExecutorService(Executors.newScheduledThreadPool(5));
    executionPlanContext.setTimestampGenerator(new SystemCurrentTimeMillisTimestampGenerator());
    executionPlanContext.setSnapshotService(new SnapshotService(executionPlanContext));
    executionPlanContext.setPersistenceService(new PersistenceService(executionPlanContext));
  }
 catch (  DuplicateAnnotationException e) {
    throw new DuplicateAnnotationException(e.getMessage() + "String_Node_Str" + executionPlan.toString());
  }
  ExecutionPlanRuntime executionPlanRuntime=new ExecutionPlanRuntime(executionPlanContext);
  defineStreamDefinitions(executionPlanRuntime,executionPlan.getStreamDefinitionMap());
  defineTableDefinitions(executionPlanRuntime,executionPlan.getTableDefinitionMap());
  try {
    for (    ExecutionElement executionElement : executionPlan.getExecutionElementList()) {
      if (executionElement instanceof Query) {
        QueryRuntime queryRuntime=QueryParser.parse((Query)executionElement,executionPlanContext,executionPlanRuntime.getStreamDefinitionMap(),executionPlanRuntime.getTableDefinitionMap(),executionPlanRuntime.getEventTableMap());
        executionPlanRuntime.addQuery(queryRuntime);
      }
 else {
        PartitionRuntime partitionRuntime=PartitionParser.parse(executionPlanRuntime,(Partition)executionElement,executionPlanContext,executionPlanRuntime.getStreamDefinitionMap());
        executionPlanRuntime.addPartition(partitionRuntime);
      }
    }
  }
 catch (  ExecutionPlanCreationException e) {
    throw new ExecutionPlanValidationException(e.getMessage() + "String_Node_Str" + executionPlanRuntime.getName()+ "String_Node_Str",e);
  }
catch (  DuplicateDefinitionException e) {
    throw new DuplicateDefinitionException(e.getMessage() + "String_Node_Str" + executionPlanRuntime.getName()+ "String_Node_Str",e);
  }
  return executionPlanRuntime;
}