Program: 174433
Project: 174433
Buggy source:
private Task fromPlan(EntityManager em,CreateTaskArg createArg,RouterObjectRef objectId) throws NotFoundException, CommsRouterException {
  Router router=getRouter(em,objectId);
  Task task=new Task(objectId);
  task.setRouter(router);
  task.setRequirements(app.entityMapper.attributes.fromDto(createArg.getRequirements()));
  if (createArg.getPlanRef() != null) {
    Plan plan=app.db.plan.get(em,RouterObjectRef.builder().setRef(createArg.getPlanRef()).setRouterRef(objectId.getRouterRef()).build());
    Route matchedRoute=null;
    List<Rule> rules=plan.getRules();
    for (    Rule rule : rules) {
      CommsRouterEvaluator evaluator=app.evaluatorFactory.provide(rule.getPredicate());
      evaluator.changeExpression(rule.getPredicate());
      matchedRoute=getMatchedRoute(task.getRef(),task.getRequirements(),rule,evaluator);
      if (matchedRoute != null) {
        task.setRule(rule);
        break;
      }
    }
    if (matchedRoute == null) {
      matchedRoute=plan.getDefaultRoute();
    }
    if (matchedRoute == null) {
      throw new NotFoundException("String_Node_Str" + createArg);
    }
    if (matchedRoute.getQueue() == null) {
      throw new NotFoundException("String_Node_Str");
    }
    task.setQueue(matchedRoute.getQueue());
    task.setPriority(matchedRoute.getPriority());
    task.setQueuedTimeout(matchedRoute.getTimeout());
    if (task.getQueuedTimeout() > 0) {
      task.setExpirationDate(new Date(System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(task.getQueuedTimeout())));
    }
    task.setCurrentRoute(matchedRoute);
  }
 else {
    Queue queue=app.db.queue.get(em,RouterObjectRef.builder().setRef(createArg.getQueueRef()).setRouterRef(objectId.getRouterRef()).build());
    task.setQueue(queue);
  }
  return task;
}

Fixed version (ground truth):
private Task fromPlan(EntityManager em,CreateTaskArg createArg,RouterObjectRef objectId) throws NotFoundException, CommsRouterException {
  Router router=getRouter(em,objectId);
  Task task=new Task(objectId);
  task.setRouter(router);
  task.setRequirements(app.entityMapper.attributes.fromDto(createArg.getRequirements()));
  if (createArg.getPlanRef() != null) {
    Plan plan=app.db.plan.get(em,RouterObjectRef.builder().setRef(createArg.getPlanRef()).setRouterRef(objectId.getRouterRef()).build());
    Route matchedRoute=null;
    List<Rule> rules=plan.getRules();
    for (    Rule rule : rules) {
      CommsRouterEvaluator evaluator=app.evaluatorFactory.provide(rule.getPredicate());
      matchedRoute=getMatchedRoute(task.getRef(),task.getRequirements(),rule,evaluator);
      if (matchedRoute != null) {
        task.setRule(rule);
        break;
      }
    }
    if (matchedRoute == null) {
      matchedRoute=plan.getDefaultRoute();
    }
    if (matchedRoute == null) {
      throw new NotFoundException("String_Node_Str" + createArg);
    }
    if (matchedRoute.getQueue() == null) {
      throw new NotFoundException("String_Node_Str");
    }
    task.setQueue(matchedRoute.getQueue());
    task.setPriority(matchedRoute.getPriority());
    task.setQueuedTimeout(matchedRoute.getTimeout());
    if (task.getQueuedTimeout() > 0) {
      task.setExpirationDate(new Date(System.currentTimeMillis() + TimeUnit.SECONDS.toMillis(task.getQueuedTimeout())));
    }
    task.setCurrentRoute(matchedRoute);
  }
 else {
    Queue queue=app.db.queue.get(em,RouterObjectRef.builder().setRef(createArg.getQueueRef()).setRouterRef(objectId.getRouterRef()).build());
    task.setQueue(queue);
  }
  return task;
}