nus-yam/ex-repair huggingface dataset:
Program: 87181
Project: 87181
Buggy source:
private void fetchBlogs(Document doc,String url) throws Exception {
  Elements blogs=doc.select("String_Node_Str");
  log.debug("String_Node_Str" + blogs.size());
  for (  Element blog : blogs) {
    Element titleElement=blog.select("String_Node_Str").get(0);
    String title=fetchTitle(titleElement);
    String link=url + titleElement.attr("String_Node_Str");
    log.debug(format("String_Node_Str",link));
    String blogId=fetchBlogId(link);
    Elements tags=blog.select("String_Node_Str");
    Author author=authorService.fetchAuthor(tags);
    String time=DbaUtil.parseIteyeTime(blog.select("String_Node_Str").get(0).text());
    int view=fetchNumber(blog.select("String_Node_Str").get(1).text());
    int comment=fetchNumber(blog.select("String_Node_Str").get(2).text());
    Blog result=blogRepository.findByBlogIdAndWebsite(blogId,ITEYE_KEY_WORD);
    if (result != null) {
      blogRepository.updateBlogFor(result.getId(),title,view,comment,author.getGroupName(),author.getName());
      continue;
    }
    blogRepository.save(new Blog(title,link,view,comment,time,author,blogId,ITEYE_KEY_WORD));
  }
}

Fixed version (ground truth):
private void fetchBlogs(Document doc,String url) throws Exception {
  Elements blogs=doc.select("String_Node_Str");
  log.debug("String_Node_Str" + blogs.size());
  for (  Element blog : blogs) {
    Element titleElement=blog.select("String_Node_Str").get(0);
    String title=fetchTitle(titleElement);
    String link=url.substring(0,url.lastIndexOf("String_Node_Str")) + titleElement.attr("String_Node_Str");
    log.debug(format("String_Node_Str",link));
    String blogId=fetchBlogId(link);
    Elements tags=blog.select("String_Node_Str");
    Author author=authorService.fetchAuthor(tags);
    String time=DbaUtil.parseIteyeTime(blog.select("String_Node_Str").get(0).text());
    int view=fetchNumber(blog.select("String_Node_Str").get(1).text());
    int comment=fetchNumber(blog.select("String_Node_Str").get(2).text());
    Blog result=blogRepository.findByBlogIdAndWebsite(blogId,ITEYE_KEY_WORD);
    if (result != null) {
      blogRepository.updateBlogFor(result.getId(),title,view,comment,author.getGroupName(),author.getName());
      continue;
    }
    blogRepository.save(new Blog(title,link,view,comment,time,author,blogId,ITEYE_KEY_WORD));
  }
}
Program: 87182
Project: 87182
Buggy source:
private static JsonNode executeCommand(JsonNode currentNode,String command){
  JsonNode newNode=null;
  if (currentNode != null) {
    System.out.println("String_Node_Str" + currentNode);
    String argument=command.substring(4,command.length() - 1);
    if (command.startsWith("String_Node_Str")) {
      int index=Integer.parseInt(argument);
      newNode=currentNode.get(index);
    }
 else {
      newNode=currentNode.get(command);
    }
    System.out.println("String_Node_Str" + newNode);
  }
  return newNode;
}

Fixed version (ground truth):
private static JsonNode executeCommand(JsonNode currentNode,String command){
  JsonNode newNode=null;
  if (currentNode != null) {
    System.out.println("String_Node_Str" + currentNode);
    if (isGet(command)) {
      String argument=command.substring(4,command.length() - 1);
      int index=Integer.parseInt(argument);
      newNode=currentNode.get(index);
    }
 else {
      newNode=currentNode.get(command);
    }
    System.out.println("String_Node_Str" + newNode);
  }
  return newNode;
}
Program: 87184
Project: 87184
Buggy source:
@Test public void freeResources(){
  Ping ping=getTestNodePing();
  Cluster cluster=clusterDao.create("String_Node_Str",TAGS);
  Node node=nodeDao.create(cluster,ping);
  nodeDao.allocate(node,1,1024);
  nodeDao.free(node,1,1024);
  assertEquals(ping.hw.physicalCpus,simpleJdbcTemplate.queryForInt("String_Node_Str",node.getNodeId()));
  assertEquals(ping.hw.totalRamMb - Defaults.NODE_RESERVE_MEMORY,simpleJdbcTemplate.queryForInt("String_Node_Str",node.getNodeId()));
}

Fixed version (ground truth):
@Test public void freeResources(){
  Ping ping=getTestNodePing();
  Cluster cluster=clusterDao.create("String_Node_Str",TAGS);
  Node node=nodeDao.create(cluster,ping);
  nodeDao.allocate(node,1,1024);
  nodeDao.free(node,1,1024);
  assertEquals(ping.hw.physicalCpus,simpleJdbcTemplate.queryForInt("String_Node_Str",node.getNodeId()));
  assertEquals(ping.hw.totalRamMb - PlowUtils.getReservedRam(ping.hw.totalRamMb),simpleJdbcTemplate.queryForInt("String_Node_Str",node.getNodeId()));
}
Program: 87185
Project: 87185
Buggy source:
@Test public void allocateResources(){
  Ping ping=getTestNodePing();
  Cluster cluster=clusterDao.create("String_Node_Str",TAGS);
  Node node=nodeDao.create(cluster,ping);
  nodeDao.allocate(node,1,1024);
  assertEquals(ping.hw.physicalCpus - 1,simpleJdbcTemplate.queryForInt("String_Node_Str",node.getNodeId()));
  assertEquals(ping.hw.totalRamMb - 1024 - Defaults.NODE_RESERVE_MEMORY,simpleJdbcTemplate.queryForInt("String_Node_Str",node.getNodeId()));
}

Fixed version (ground truth):
@Test public void allocateResources(){
  Ping ping=getTestNodePing();
  Cluster cluster=clusterDao.create("String_Node_Str",TAGS);
  Node node=nodeDao.create(cluster,ping);
  int reserved=PlowUtils.getReservedRam(ping.hw.totalRamMb);
  assertEquals(ping.hw.totalRamMb - reserved,simpleJdbcTemplate.queryForInt("String_Node_Str",node.getNodeId()));
  nodeDao.allocate(node,1,1024);
  assertEquals(ping.hw.physicalCpus - 1,simpleJdbcTemplate.queryForInt("String_Node_Str",node.getNodeId()));
  assertEquals(ping.hw.totalRamMb - 1024 - reserved,simpleJdbcTemplate.queryForInt("String_Node_Str",node.getNodeId()));
}
Program: 87186
Project: 87186
Buggy source:
@Test public void testAllocateSingleResourceProc(){
  nodeService.setNodeSlotMode(node,SlotMode.SINGLE,2,4096);
  node=dispatchService.getDispatchNode(node.getName());
  assertTrue(dispatchService.reserveTask(tasks.get(0)));
  DispatchProc proc=dispatchService.allocateProc(node,tasks.get(0));
  assertEquals(2,proc.getCores());
  assertEquals(8096 - Defaults.NODE_RESERVE_MEMORY,proc.getRam());
}

Fixed version (ground truth):
@Test public void testAllocateSingleResourceProc(){
  nodeService.setNodeSlotMode(node,SlotMode.SINGLE,2,4096);
  node=dispatchService.getDispatchNode(node.getName());
  assertTrue(dispatchService.reserveTask(tasks.get(0)));
  DispatchProc proc=dispatchService.allocateProc(node,tasks.get(0));
  assertEquals(2,proc.getCores());
  assertEquals(8096 - Defaults.NODE_RESERVE_MEMORY_MAX,proc.getRam());
}
Program: 87187
Project: 87187
Buggy source:
@Test public void testAllocateRuntSlotProc(){
  nodeService.setNodeSlotMode(node,SlotMode.SLOTS,1,4000);
  node=dispatchService.getDispatchNode(node.getName());
  assertTrue(dispatchService.reserveTask(tasks.get(0)));
  DispatchProc proc=dispatchService.allocateProc(node,tasks.get(0));
  assertEquals(1,proc.getCores());
  assertEquals(4000,proc.getRam());
  node.allocate(1,4000);
  assertTrue(dispatchService.reserveTask(tasks.get(1)));
  proc=dispatchService.allocateProc(node,tasks.get(1));
  assertEquals(1,proc.getCores());
  assertEquals(3584,proc.getRam());
}

Fixed version (ground truth):
@Test public void testAllocateRuntSlotProc(){
  nodeService.setNodeSlotMode(node,SlotMode.SLOTS,1,4000);
  node=dispatchService.getDispatchNode(node.getName());
  assertTrue(dispatchService.reserveTask(tasks.get(0)));
  DispatchProc proc=dispatchService.allocateProc(node,tasks.get(0));
  assertEquals(1,proc.getCores());
  assertEquals(4000,proc.getRam());
  node.allocate(1,4000);
  assertTrue(dispatchService.reserveTask(tasks.get(1)));
  proc=dispatchService.allocateProc(node,tasks.get(1));
  assertEquals(1,proc.getCores());
  assertEquals(3712,proc.getRam());
}
Program: 87188
Project: 87188
Buggy source:
protected void dispatchFailed(DispatchResult result,DispatchProc proc,DispatchTask task,String message){
  logger.error("String_Node_Str",new Object[]{proc,task,message});
  if (task != null) {
    if (task.started) {
      dispatchService.stopTask(task,TaskState.WAITING,ExitStatus.FAIL,Signal.ABORTED_TASK);
    }
 else {
      dispatchService.unreserveTask(task);
    }
  }
  dispatchService.unassignProc(proc);
  dispatchService.markAsDeallocated(proc);
  if (result != null) {
    result.continueDispatch=false;
  }
}

Fixed version (ground truth):
protected void dispatchFailed(DispatchResult result,DispatchProc proc,DispatchTask task,String message){
  logger.error("String_Node_Str",new Object[]{proc,task,message});
  if (task != null) {
    if (task.started) {
      dispatchService.stopTask(task,TaskState.WAITING,ExitStatus.FAIL,Signal.ABORTED_TASK);
    }
 else {
      dispatchService.unreserveTask(task);
    }
  }
  if (proc != null) {
    dispatchService.unassignAndMarkForDeallocation(proc);
  }
  if (result != null) {
    result.continueDispatch=false;
  }
}
Program: 87189
Project: 87189
Buggy source:
@Override public boolean unassign(Proc proc){
  return jdbc.update(UNASSIGN,proc.getProcId()) == 1;
}

Fixed version (ground truth):
@Override public boolean unassign(Proc proc){
  if (proc == null) {
    return false;
  }
  return jdbc.update(UNASSIGN,proc.getProcId()) == 1;
}
Program: 87190
Project: 87190
Buggy source:
@Override public boolean updateProcRuntimeStats(final RunningTask task){
  return jdbc.update(new PreparedStatementCreator(){
    @Override public PreparedStatement createPreparedStatement(    final Connection conn) throws SQLException {
      final float cores_used=task.cpuPercent / 100.0f;
      final Long[] io_stats={task.diskIO.readCount,task.diskIO.writeCount,task.diskIO.readBytes,task.diskIO.writeBytes};
      final PreparedStatement ret=conn.prepareStatement(UPDATE_RUNTIME);
      ret.setInt(1,task.rssMb);
      ret.setInt(2,task.rssMb);
      ret.setInt(3,(int)Math.min(100,Math.round(task.progress)));
      ret.setFloat(4,cores_used);
      ret.setFloat(5,cores_used);
      ret.setString(6,task.lastLog);
      ret.setArray(7,conn.createArrayOf("String_Node_Str",io_stats));
      ret.setObject(8,UUID.fromString(task.procId));
      ret.setObject(9,UUID.fromString(task.taskId));
      return ret;
    }
  }
) == 1;
}

Fixed version (ground truth):
@Override public boolean updateProcRuntimeStats(final RunningTask task){
  return jdbc.update(new PreparedStatementCreator(){
    @Override public PreparedStatement createPreparedStatement(    final Connection conn) throws SQLException {
      final float cores_used=task.cpuPercent / 100.0f;
      final Long[] io_stats=new Long[]{0L,0L,0L,0L};
      if (task.diskIO != null) {
        io_stats[0]=task.diskIO.readCount;
        io_stats[1]=task.diskIO.writeCount;
        io_stats[2]=task.diskIO.readBytes;
        io_stats[3]=task.diskIO.writeBytes;
        ;
      }
      final PreparedStatement ret=conn.prepareStatement(UPDATE_RUNTIME);
      ret.setInt(1,task.rssMb);
      ret.setInt(2,task.rssMb);
      ret.setInt(3,(int)Math.min(100,Math.round(task.progress)));
      ret.setFloat(4,cores_used);
      ret.setFloat(5,cores_used);
      ret.setString(6,task.lastLog);
      ret.setArray(7,conn.createArrayOf("String_Node_Str",io_stats));
      ret.setObject(8,UUID.fromString(task.procId));
      ret.setObject(9,UUID.fromString(task.taskId));
      return ret;
    }
  }
) == 1;
}
Program: 87191
Project: 87191
Buggy source:
@Override public PreparedStatement createPreparedStatement(final Connection conn) throws SQLException {
  final float cores_used=task.cpuPercent / 100.0f;
  final Long[] io_stats={task.diskIO.readCount,task.diskIO.writeCount,task.diskIO.readBytes,task.diskIO.writeBytes};
  final PreparedStatement ret=conn.prepareStatement(UPDATE_RUNTIME);
  ret.setInt(1,task.rssMb);
  ret.setInt(2,task.rssMb);
  ret.setInt(3,(int)Math.min(100,Math.round(task.progress)));
  ret.setFloat(4,cores_used);
  ret.setFloat(5,cores_used);
  ret.setString(6,task.lastLog);
  ret.setArray(7,conn.createArrayOf("String_Node_Str",io_stats));
  ret.setObject(8,UUID.fromString(task.procId));
  ret.setObject(9,UUID.fromString(task.taskId));
  return ret;
}

Fixed version (ground truth):
@Override public PreparedStatement createPreparedStatement(final Connection conn) throws SQLException {
  final float cores_used=task.cpuPercent / 100.0f;
  final Long[] io_stats=new Long[]{0L,0L,0L,0L};
  if (task.diskIO != null) {
    io_stats[0]=task.diskIO.readCount;
    io_stats[1]=task.diskIO.writeCount;
    io_stats[2]=task.diskIO.readBytes;
    io_stats[3]=task.diskIO.writeBytes;
    ;
  }
  final PreparedStatement ret=conn.prepareStatement(UPDATE_RUNTIME);
  ret.setInt(1,task.rssMb);
  ret.setInt(2,task.rssMb);
  ret.setInt(3,(int)Math.min(100,Math.round(task.progress)));
  ret.setFloat(4,cores_used);
  ret.setFloat(5,cores_used);
  ret.setString(6,task.lastLog);
  ret.setArray(7,conn.createArrayOf("String_Node_Str",io_stats));
  ret.setObject(8,UUID.fromString(task.procId));
  ret.setObject(9,UUID.fromString(task.taskId));
  return ret;
}
Program: 87192
Project: 87192
Buggy source:
@Override public List<TaskT> getTasks(TaskFilterT filter){
  final List<String> where=Lists.newArrayList();
  final List<Object> values=Lists.newArrayList();
  if (PlowUtils.isValid(filter.jobId)) {
    where.add("String_Node_Str");
    values.add(UUID.fromString(filter.jobId));
  }
  if (PlowUtils.isValid(filter.layerIds)) {
    where.add(JdbcUtils.In("String_Node_Str",filter.layerIds.size()));
    values.addAll(filter.layerIds);
  }
  if (PlowUtils.isValid(filter.nodeIds)) {
    where.add(JdbcUtils.In("String_Node_Str",filter.nodeIds.size()));
    values.addAll(filter.nodeIds);
  }
  if (PlowUtils.isValid(filter.taskIds)) {
    where.add(JdbcUtils.In("String_Node_Str",filter.taskIds.size()));
    values.addAll(filter.taskIds);
  }
  if (where.isEmpty()) {
    throw new RuntimeException("String_Node_Str");
  }
  if (filter.getLastUpdateTime() > 0) {
    where.add("String_Node_Str");
    values.add(filter.getLastUpdateTime());
  }
  if (PlowUtils.isValid(filter.states)) {
    where.add(JdbcUtils.In("String_Node_Str",filter.states.size()));
    for (    TaskState state : filter.states) {
      values.add(state.ordinal());
    }
  }
  final StringBuilder sb=new StringBuilder(512);
  sb.append(GET);
  sb.append("String_Node_Str");
  sb.append(StringUtils.join(where,"String_Node_Str"));
  sb.append("String_Node_Str");
  return jdbc.query(sb.toString(),MAPPER,values.toArray());
}

Fixed version (ground truth):
@Override public List<TaskT> getTasks(TaskFilterT filter){
  final List<String> where=Lists.newArrayList();
  final List<Object> values=Lists.newArrayList();
  if (PlowUtils.isValid(filter.jobId)) {
    where.add("String_Node_Str");
    values.add(UUID.fromString(filter.jobId));
  }
  if (PlowUtils.isValid(filter.layerIds)) {
    where.add(JdbcUtils.In("String_Node_Str",filter.layerIds.size(),"String_Node_Str"));
    values.addAll(filter.layerIds);
  }
  if (PlowUtils.isValid(filter.nodeIds)) {
    where.add(JdbcUtils.In("String_Node_Str",filter.nodeIds.size(),"String_Node_Str"));
    values.addAll(filter.nodeIds);
  }
  if (PlowUtils.isValid(filter.taskIds)) {
    where.add(JdbcUtils.In("String_Node_Str",filter.taskIds.size(),"String_Node_Str"));
    values.addAll(filter.taskIds);
  }
  if (where.isEmpty()) {
    throw new RuntimeException("String_Node_Str");
  }
  if (filter.getLastUpdateTime() > 0) {
    where.add("String_Node_Str");
    values.add(filter.getLastUpdateTime());
  }
  if (PlowUtils.isValid(filter.states)) {
    where.add(JdbcUtils.In("String_Node_Str",filter.states.size()));
    for (    TaskState state : filter.states) {
      values.add(state.ordinal());
    }
  }
  final StringBuilder sb=new StringBuilder(512);
  sb.append(GET);
  sb.append("String_Node_Str");
  sb.append(StringUtils.join(where,"String_Node_Str"));
  sb.append("String_Node_Str");
  return jdbc.query(sb.toString(),MAPPER,values.toArray());
}
Program: 87194
Project: 87194
Buggy source:
@Override public boolean startTask(DispatchTask task,DispatchProc proc){
  if (dispatchTaskDao.start(task,proc)) {
    logger.info("String_Node_Str",task);
    DispatchStats.taskStartedCount.incrementAndGet();
    return true;
  }
  DispatchStats.taskStartedFailureCount.incrementAndGet();
  return false;
}

Fixed version (ground truth):
@Override public boolean startTask(DispatchTask task,DispatchProc proc){
  if (dispatchTaskDao.start(task,proc)) {
    logger.info("String_Node_Str",task);
    task.started=true;
    DispatchStats.taskStartedCount.incrementAndGet();
    return true;
  }
  DispatchStats.taskStartedFailureCount.incrementAndGet();
  return false;
}
Program: 87195
Project: 87195
Buggy source:
public void dispatch(DispatchResult result,DispatchNode node,DispatchTask task){
  if (!dispatchService.reserveTask(task)) {
    return;
  }
  DispatchProc proc=null;
  try {
    proc=dispatchService.allocateProc(node,task);
    if (dispatchService.startTask(task,proc)) {
      RunTaskCommand command=dispatchService.getRuntaskCommand(task);
      if (!result.isTest) {
        RndClient client=new RndClient(node.getName());
        client.runProcess(command);
      }
      result.dispatched(proc,task);
    }
 else {
      dispatchFailed(result,proc,null,"String_Node_Str");
    }
  }
 catch (  Exception e) {
    logger.warn("String_Node_Str" + node.getName() + "String_Node_Str"+ e,e);
    dispatchFailed(result,proc,task,e.getMessage());
  }
}

Fixed version (ground truth):
public void dispatch(DispatchResult result,DispatchNode node,DispatchTask task){
  if (!dispatchService.reserveTask(task)) {
    return;
  }
  DispatchProc proc=null;
  try {
    proc=dispatchService.allocateProc(node,task);
    if (dispatchService.startTask(task,proc)) {
      RunTaskCommand command=dispatchService.getRuntaskCommand(task);
      if (!result.isTest) {
        RndClient client=new RndClient(node.getName());
        client.runProcess(command);
      }
      result.dispatched(proc,task);
    }
 else {
      dispatchFailed(result,proc,task,"String_Node_Str");
    }
  }
 catch (  Exception e) {
    logger.warn("String_Node_Str" + node.getName() + "String_Node_Str"+ e,e);
    dispatchFailed(result,proc,task,e.getMessage());
  }
}
Program: 87196
Project: 87196
Buggy source:
public void dispatchFailed(DispatchResult result,DispatchProc proc,DispatchTask task,String message){
  logger.info("String_Node_Str",new Object[]{proc,task,message});
  result.dispatch=false;
  dispatchService.deallocateProc(proc,message);
  if (task != null) {
    dispatchService.stopTask(task,TaskState.WAITING,ExitStatus.FAIL,Signal.ABORTED_TASK);
  }
}

Fixed version (ground truth):
public void dispatchFailed(DispatchResult result,DispatchProc proc,DispatchTask task,String message){
  logger.info("String_Node_Str",new Object[]{proc,task,message});
  result.dispatch=false;
  dispatchService.deallocateProc(proc,message);
  if (task != null) {
    if (task.started) {
      dispatchService.stopTask(task,TaskState.WAITING,ExitStatus.FAIL,Signal.ABORTED_TASK);
    }
 else {
      dispatchService.unreserveTask(task);
    }
  }
}
Program: 87197
Project: 87197
Buggy source:
@Override public void dispatchFailed(DispatchResult result,DispatchProc resource,DispatchTask task,String message){
  logger.info("String_Node_Str",new Object[]{resource,task,message});
  dispatchService.deallocateProc(resource,message);
  if (task != null) {
    dispatchService.stopTask(task,TaskState.WAITING,ExitStatus.FAIL,Signal.ABORTED_TASK);
  }
  result.dispatch=false;
}

Fixed version (ground truth):
@Override public void dispatchFailed(DispatchResult result,DispatchProc resource,DispatchTask task,String message){
  logger.info("String_Node_Str",new Object[]{resource,task,message});
  dispatchService.deallocateProc(resource,message);
  if (task != null) {
    if (task.started) {
      dispatchService.stopTask(task,TaskState.WAITING,ExitStatus.FAIL,Signal.ABORTED_TASK);
    }
 else {
      dispatchService.unreserveTask(task);
    }
  }
  result.dispatch=false;
}
Program: 87198
Project: 87198
Buggy source:
@Override public void update(Node node,Ping ping){
  jdbc.update("String_Node_Str" + "String_Node_Str",node.getNodeId());
  jdbc.update(FULL_UPDATE,ping.hw.physicalCpus,ping.hw.logicalCpus,ping.hw.totalRamMb,ping.hw.freeRamMb,ping.hw.totalSwapMb,ping.hw.freeSwapMb,ping.bootTime,ping.hw.cpuModel,ping.hw.platform,node.getNodeId());
}

Fixed version (ground truth):
@Override public void update(Node node,Ping ping){
  jdbc.update("String_Node_Str" + "String_Node_Str",node.getNodeId());
  jdbc.update("String_Node_Str" + "String_Node_Str",NodeState.UP.ordinal(),node.getNodeId(),NodeState.DOWN.ordinal());
  jdbc.update(FULL_UPDATE,ping.hw.physicalCpus,ping.hw.logicalCpus,ping.hw.totalRamMb,ping.hw.freeRamMb,ping.hw.totalSwapMb,ping.hw.freeSwapMb,ping.bootTime,ping.hw.cpuModel,ping.hw.platform,node.getNodeId());
}
Program: 87199
Project: 87199
Buggy source:
@Async(value="String_Node_Str") public void eatTasks(final TaskFilterT filter){
  if (PlowUtils.isValid(filter.jobId)) {
    throw new PlowException("String_Node_Str");
  }
  stateChangeExecutor.execute(new Runnable(){
    @Override public void run(){
      final List<Task> tasks=jobService.getTasks(filter);
      logger.info("String_Node_Str",Thread.currentThread().getName(),tasks.size());
      if (tasks.isEmpty()) {
        return;
      }
      for (      final Task t : tasks) {
        eatTask(t,false);
      }
      Job job=jobService.getJob(UUID.fromString(filter.jobId));
      if (jobService.isFinished(job)) {
        shutdownJob(job);
      }
    }
  }
);
}

Fixed version (ground truth):
@Async(value="String_Node_Str") public void eatTasks(final TaskFilterT filter){
  if (PlowUtils.isValid(filter.jobId)) {
    throw new PlowException("String_Node_Str");
  }
  stateChangeExecutor.execute(new Runnable(){
    @Override public void run(){
      final List<Task> tasks=jobService.getTasks(filter);
      logger.info("String_Node_Str",Thread.currentThread().getName(),tasks.size());
      if (tasks.isEmpty()) {
        return;
      }
      Set<UUID> jobIds=Sets.newHashSet();
      for (      final Task t : tasks) {
        eatTask(t,false);
        jobIds.add(t.getJobId());
      }
      for (      UUID jobId : jobIds) {
        Job job=jobService.getJob(jobId);
        if (jobService.isFinished(job)) {
          shutdownJob(job);
        }
      }
    }
  }
);
}
Program: 87200
Project: 87200
Buggy source:
@Async(value="String_Node_Str") public void eatTasks(TaskFilterT filter){
  final List<Task> tasks=jobService.getTasks(filter);
  logger.info("String_Node_Str",Thread.currentThread().getName(),tasks.size());
  for (  final Task t : tasks) {
    stateChangeExecutor.execute(new Runnable(){
      @Override public void run(){
        eatTask(t);
      }
    }
);
  }
}

Fixed version (ground truth):
@Async(value="String_Node_Str") public void eatTasks(final TaskFilterT filter){
  if (PlowUtils.isValid(filter.jobId)) {
    throw new PlowException("String_Node_Str");
  }
  stateChangeExecutor.execute(new Runnable(){
    @Override public void run(){
      final List<Task> tasks=jobService.getTasks(filter);
      logger.info("String_Node_Str",Thread.currentThread().getName(),tasks.size());
      if (tasks.isEmpty()) {
        return;
      }
      for (      final Task t : tasks) {
        eatTask(t,false);
      }
      Job job=jobService.getJob(UUID.fromString(filter.jobId));
      if (jobService.isFinished(job)) {
        shutdownJob(job);
      }
    }
  }
);
}
Program: 87201
Project: 87201
Buggy source:
public void eatTask(Task task){
  logger.info("String_Node_Str",Thread.currentThread().getName(),task.getTaskId());
  if (dispatchService.stopTask(task,TaskState.EATEN,ExitStatus.FAIL,Signal.MANUAL_KILL)) {
    killProc(task,false);
  }
 else {
    jobService.setTaskState(task,TaskState.EATEN);
  }
}

Fixed version (ground truth):
public void eatTask(Task task,boolean checkFinished){
  logger.info("String_Node_Str",Thread.currentThread().getName(),task.getTaskId());
  if (dispatchService.stopTask(task,TaskState.EATEN,ExitStatus.FAIL,Signal.MANUAL_KILL)) {
    killProc(task,false);
  }
 else {
    jobService.setTaskState(task,TaskState.EATEN);
  }
  if (checkFinished) {
    Job job=jobService.getJob(task.getJobId());
    if (jobService.isFinished(job)) {
      shutdownJob(job);
    }
  }
}
Program: 87203
Project: 87203
Buggy source:
public void setTags(List<String> tags){
  this.tags=tags;
}

Fixed version (ground truth):
public void setTags(List<String> tags){
  setTags=true;
  this.tags=tags;
}
Program: 87204
Project: 87204
Buggy source:
@Override public DispatchProc allocateProc(DispatchNode node,DispatchableTask task){
  logger.info("String_Node_Str",node);
  if (!quotaDao.check(node,task,task.minCores)) {
    throw new PlowDispatcherException("String_Node_Str" + node.getName() + "String_Node_Str");
  }
  try {
    nodeDao.allocate(node,task.minCores,task.minRam);
    quotaDao.allocate(node,task,task.minCores);
    DispatchProc proc=procDao.create(node,task);
    dispatchDao.incrementDispatchTotals(proc);
    return proc;
  }
 catch (  Exception e) {
    throw new PlowDispatcherException("String_Node_Str" + node.getName() + "String_Node_Str"+ e,e);
  }
}

Fixed version (ground truth):
@Override public DispatchProc allocateProc(DispatchNode node,DispatchableTask task){
  logger.info("String_Node_Str",node);
  if (!quotaDao.check(node,task,task.minCores)) {
    throw new PlowDispatcherException("String_Node_Str" + node.getName() + "String_Node_Str");
  }
  try {
    nodeDao.allocate(node,task.minCores,task.minRam);
    quotaDao.allocate(node,task,task.minCores);
    DispatchProc proc=procDao.create(node,task);
    dispatchDao.incrementDispatchTotals(proc);
    node.allocate(task.minCores,task.minRam);
    return proc;
  }
 catch (  Exception e) {
    throw new PlowDispatcherException("String_Node_Str" + node.getName() + "String_Node_Str"+ e,e);
  }
}
Program: 87205
Project: 87205
Buggy source:
public void dispatch(DispatchResult result,DispatchNode node,DispatchableTask task){
  if (!dispatchService.reserveTask(task)) {
    return;
  }
  DispatchProc proc=null;
  try {
    proc=dispatchService.allocateProc(node,task);
    if (dispatchService.startTask(node.getName(),task)) {
      RunTaskCommand command=dispatchService.getRuntaskCommand(task);
      if (!result.isTest) {
        RndClient client=new RndClient(node.getName());
        client.runProcess(command);
      }
      result.dispatched(proc);
    }
 else {
      cleanup(result,proc,task,"String_Node_Str");
    }
  }
 catch (  Exception e) {
    logger.warn("String_Node_Str" + node.getName() + "String_Node_Str"+ e,e);
    cleanup(result,proc,task,e.getMessage());
  }
}

Fixed version (ground truth):
public void dispatch(DispatchResult result,DispatchNode node,DispatchableTask task){
  if (!dispatchService.reserveTask(task)) {
    return;
  }
  DispatchProc proc=null;
  try {
    proc=dispatchService.allocateProc(node,task);
    if (dispatchService.startTask(node.getName(),task)) {
      RunTaskCommand command=dispatchService.getRuntaskCommand(task);
      if (!result.isTest) {
        RndClient client=new RndClient(node.getName());
        client.runProcess(command);
      }
      result.dispatched(proc,task);
    }
 else {
      cleanup(result,proc,task,"String_Node_Str");
    }
  }
 catch (  Exception e) {
    logger.warn("String_Node_Str" + node.getName() + "String_Node_Str"+ e,e);
    cleanup(result,proc,task,e.getMessage());
  }
}
Program: 87206
Project: 87206
Buggy source:
@Override public void allocate(int cores,int ram){
  this.cores=this.cores - cores;
  this.memory=this.memory - memory;
}

Fixed version (ground truth):
@Override public void allocate(int cores,int ram){
  this.cores=this.cores - cores;
  this.memory=this.memory - ram;
}
Program: 87207
Project: 87207
Buggy source:
/** 
 * Check if the given resource can still be dispatched.
 * @return
 */
public boolean continueDispatching(){
  if (procs.size() >= maxProcs) {
    return false;
  }
  if (cores >= maxCores) {
    return false;
  }
  if (procs.size() >= DispatchConfig.MAX_PROCS_PER_JOB) {
    return false;
  }
  if (resource.getIdleCores() < 1) {
    return false;
  }
  if (resource.getIdleRam() <= 0) {
    return false;
  }
  return dispatch;
}

Fixed version (ground truth):
/** 
 * Check if the given resource can still be dispatched.
 * @return
 */
public boolean continueDispatching(){
  if (procs.size() >= maxProcs) {
    logger.info("String_Node_Str",procs.size(),maxProcs);
    return false;
  }
  if (cores >= maxCores) {
    logger.info("String_Node_Str",cores,maxCores);
  }
  if (procs.size() >= DispatchConfig.MAX_PROCS_PER_JOB) {
    logger.info("String_Node_Str",procs.size(),DispatchConfig.MAX_PROCS_PER_JOB);
    return false;
  }
  if (resource.getIdleCores() < 1) {
    logger.info("String_Node_Str",resource.getIdleCores());
    return false;
  }
  if (resource.getIdleRam() <= 0) {
    logger.info("String_Node_Str",resource.getIdleRam());
    return false;
  }
  return dispatch;
}
Program: 87208
Project: 87208
Buggy source:
public void dispatched(DispatchProc proc){
  cores+=proc.getIdleCores();
  ram+=proc.getIdleRam();
  procs.add(proc);
  resource.allocate(proc.getIdleCores(),proc.getIdleRam());
  logger.info("String_Node_Str",new Object[]{proc.getHostname(),resource.getIdleCores(),resource.getIdleRam()});
}

Fixed version (ground truth):
public void dispatched(DispatchProc proc,DispatchableTask task){
  cores+=task.minCores;
  ram+=task.minRam;
  procs.add(proc);
  logger.info("String_Node_Str",new Object[]{proc.getHostname(),resource.getIdleCores(),resource.getIdleRam()});
}
Program: 87209
Project: 87209
Buggy source:
public boolean canDispatch(DispatchableTask task){
  if (resource.getIdleCores() < task.minCores) {
    return false;
  }
  if (resource.getIdleRam() < task.minRam) {
    return false;
  }
  return true;
}

Fixed version (ground truth):
public boolean canDispatch(DispatchableTask task){
  if (resource.getIdleCores() < task.minCores) {
    logger.info("String_Node_Str",resource.getIdleCores(),task.minCores);
    return false;
  }
  if (resource.getIdleRam() < task.minRam) {
    logger.info("String_Node_Str",resource.getIdleRam(),task.minRam);
    return false;
  }
  return true;
}
Program: 87210
Project: 87210
Buggy source:
@Override public DispatchProc allocateProc(DispatchNode node,DispatchTask task){
  logger.info("String_Node_Str",node);
  if (!quotaDao.check(node,task,task.minCores)) {
    throw new PlowDispatcherException("String_Node_Str" + node.getName() + "String_Node_Str");
  }
  try {
    nodeDao.allocate(node,task.minCores,task.minRam);
    quotaDao.allocate(node,task,task.minCores);
    DispatchProc proc=procDao.create(node,task);
    dispatchDao.incrementDispatchTotals(proc);
    return proc;
  }
 catch (  Exception e) {
    throw new PlowDispatcherException("String_Node_Str" + node.getName() + "String_Node_Str"+ e,e);
  }
}

Fixed version (ground truth):
@Override public DispatchProc allocateProc(DispatchNode node,DispatchTask task){
  logger.info("String_Node_Str",node);
  if (!quotaDao.check(node,task,task.minCores)) {
    throw new PlowDispatcherException("String_Node_Str" + node.getName() + "String_Node_Str");
  }
  try {
    DispatchProc proc=procDao.create(node,task);
    nodeDao.allocate(node,task.minCores,task.minRam);
    quotaDao.allocate(node,task,task.minCores);
    dispatchDao.incrementDispatchTotals(proc);
    return proc;
  }
 catch (  Exception e) {
    throw new PlowDispatcherException("String_Node_Str" + node.getName() + "String_Node_Str"+ e,e);
  }
}
Program: 87211
Project: 87211
Buggy source:
public void dispatch(DispatchResult result,DispatchNode node,DispatchTask task){
  if (!dispatchService.reserveTask(task)) {
    return;
  }
  DispatchProc proc=null;
  try {
    proc=dispatchService.allocateProc(node,task);
    if (dispatchService.startTask(node.getName(),task)) {
      RunTaskCommand command=dispatchService.getRuntaskCommand(task);
      if (!result.isTest) {
        RndClient client=new RndClient(node.getName());
        client.runProcess(command);
      }
      result.dispatched(proc,task);
    }
 else {
      cleanup(result,proc,task,"String_Node_Str");
    }
  }
 catch (  Exception e) {
    logger.warn("String_Node_Str" + node.getName() + "String_Node_Str"+ e,e);
    cleanup(result,proc,task,e.getMessage());
  }
}

Fixed version (ground truth):
public void dispatch(DispatchResult result,DispatchNode node,DispatchTask task){
  if (!dispatchService.reserveTask(task)) {
    return;
  }
  DispatchProc proc=null;
  try {
    proc=dispatchService.allocateProc(node,task);
    if (dispatchService.startTask(node.getName(),task)) {
      RunTaskCommand command=dispatchService.getRuntaskCommand(task);
      if (!result.isTest) {
        RndClient client=new RndClient(node.getName());
        client.runProcess(command);
      }
      result.dispatched(proc,task);
    }
 else {
      dispatchFailed(result,proc,null,"String_Node_Str");
    }
  }
 catch (  Exception e) {
    logger.warn("String_Node_Str" + node.getName() + "String_Node_Str"+ e,e);
    dispatchFailed(result,proc,task,e.getMessage());
  }
}
Program: 87212
Project: 87212
Buggy source:
public void dispatch(DispatchResult result,DispatchProc proc,DispatchTask task){
  if (!dispatchService.reserveTask(task)) {
    return;
  }
  try {
    dispatchService.assignProc(proc,task);
    if (dispatchService.startTask(proc.getHostname(),task)) {
      RunTaskCommand command=dispatchService.getRuntaskCommand(task);
      RndClient client=new RndClient(proc.getHostname());
      client.runProcess(command);
      result.dispatched(proc,task);
      result.dispatch=false;
    }
 else {
      cleanup(result,proc,task,"String_Node_Str");
    }
  }
 catch (  Exception e) {
    logger.warn("String_Node_Str" + e);
    cleanup(result,proc,task,e.getMessage());
  }
}

Fixed version (ground truth):
@Override public void dispatch(DispatchResult result,DispatchProc resource,DispatchJob job){
}
Program: 87213
Project: 87213
Buggy source:
@Override public void run(){
  final DispatchResult result=new DispatchResult(proc);
  dispatcher.dispatch(result,proc);
}

Fixed version (ground truth):
@Override public void run(){
  final DispatchResult result=new DispatchResult(proc);
  dispatcher.dispatch(result,proc);
  if (result.procs.isEmpty()) {
    dispatcher.dispatchFailed(result,proc,null,"String_Node_Str");
  }
}
Program: 87214
Project: 87214
Buggy source:
@Override public boolean reserve(Task task){
  try {
    jdbc.queryForObject("String_Node_Str",String.class,task.getTaskId());
    return jdbc.update("String_Node_Str" + "String_Node_Str",task.getTaskId()) == 1;
  }
 catch (  Exception e) {
    return false;
  }
}

Fixed version (ground truth):
@Override public boolean reserve(Task task){
  try {
    jdbc.queryForObject("String_Node_Str",String.class,task.getTaskId(),TaskState.WAITING.ordinal());
    return jdbc.update("String_Node_Str" + "String_Node_Str",task.getTaskId(),TaskState.WAITING.ordinal()) == 1;
  }
 catch (  Exception e) {
    return false;
  }
}
Program: 87215
Project: 87215
Buggy source:
@Override public DispatchProc allocateProc(DispatchNode node,DispatchableTask task){
  logger.info("String_Node_Str",node);
  if (!quotaDao.check(node,task,task.minCores)) {
    throw new PlowDispatcherException("String_Node_Str" + node.getName() + "String_Node_Str");
  }
  try {
    nodeDao.allocate(node,task.minCores,task.minRam);
    quotaDao.allocate(node,task,task.minCores);
    DispatchProc proc=procDao.create(node,task);
    dispatchDao.incrementDispatchTotals(proc);
    node.allocate(task.minCores,task.minRam);
    return proc;
  }
 catch (  Exception e) {
    throw new PlowDispatcherException("String_Node_Str" + node.getName() + "String_Node_Str"+ e,e);
  }
}

Fixed version (ground truth):
@Override public DispatchProc allocateProc(DispatchNode node,DispatchableTask task){
  logger.info("String_Node_Str",node);
  if (!quotaDao.check(node,task,task.minCores)) {
    throw new PlowDispatcherException("String_Node_Str" + node.getName() + "String_Node_Str");
  }
  try {
    nodeDao.allocate(node,task.minCores,task.minRam);
    quotaDao.allocate(node,task,task.minCores);
    DispatchProc proc=procDao.create(node,task);
    dispatchDao.incrementDispatchTotals(proc);
    return proc;
  }
 catch (  Exception e) {
    throw new PlowDispatcherException("String_Node_Str" + node.getName() + "String_Node_Str"+ e,e);
  }
}
Program: 87216
Project: 87216
Buggy source:
public void dispatched(DispatchProc proc,DispatchableTask task){
  cores+=task.minCores;
  ram+=task.minRam;
  procs.add(proc);
  logger.info("String_Node_Str",new Object[]{proc.getHostname(),resource.getIdleCores(),resource.getIdleRam()});
}

Fixed version (ground truth):
public void dispatched(DispatchProc proc,DispatchableTask task){
  cores+=task.minCores;
  ram+=task.minRam;
  procs.add(proc);
  resource.allocate(task.minCores,task.minRam);
  logger.info("String_Node_Str",new Object[]{proc.getHostname(),resource.getIdleCores(),resource.getIdleRam()});
}
Program: 87217
Project: 87217
Buggy source:
@Override public boolean check(Cluster cluster,Project project,int cores){
  return jdbc.queryForInt(QUOTA_CHECK,cluster.getClusterId(),project.getProjectId(),cores) == 1;
}

Fixed version (ground truth):
@Override public boolean check(Cluster cluster,Project project,int cores){
  return jdbc.queryForInt(QUOTA_CHECK,project.getProjectId(),cluster.getClusterId(),cores) == 1;
}
Program: 87218
Project: 87218
Buggy source:
@Override public Job create(final Project project,final JobSpecT spec){
  final UUID jobId=UUID.randomUUID();
  jdbc.update(new PreparedStatementCreator(){
    @Override public PreparedStatement createPreparedStatement(    final Connection conn) throws SQLException {
      final PreparedStatement ret=conn.prepareStatement(INSERT[0]);
      ret.setObject(1,jobId);
      ret.setObject(2,project.getProjectId());
      ret.setString(3,spec.getName());
      ret.setString(4,spec.getName());
      ret.setString(5,spec.username);
      ret.setInt(6,spec.getUid());
      ret.setInt(7,JobState.INITIALIZE.ordinal());
      ret.setBoolean(8,spec.isPaused());
      ret.setString(9,String.format("String_Node_Str",spec.logPath,spec.name));
      ret.setObject(10,spec.attrs);
      return ret;
    }
  }
);
  jdbc.update("String_Node_Str",jobId);
  jdbc.update("String_Node_Str",jobId);
  jdbc.update("String_Node_Str",jobId);
  final JobE job=new JobE();
  job.setJobId(jobId);
  job.setProjectId(project.getProjectId());
  job.setFolderId(null);
  return job;
}

Fixed version (ground truth):
@Override public Job create(final Project project,final JobSpecT spec){
  final UUID jobId=UUID.randomUUID();
  jdbc.update(new PreparedStatementCreator(){
    @Override public PreparedStatement createPreparedStatement(    final Connection conn) throws SQLException {
      final PreparedStatement ret=conn.prepareStatement(INSERT[0]);
      ret.setObject(1,jobId);
      ret.setObject(2,project.getProjectId());
      ret.setString(3,spec.getName());
      ret.setString(4,spec.getName());
      ret.setString(5,spec.username);
      ret.setInt(6,spec.getUid());
      ret.setInt(7,JobState.INITIALIZE.ordinal());
      ret.setBoolean(8,spec.isPaused());
      ret.setString(9,String.format("String_Node_Str",spec.logPath,spec.name));
      ret.setObject(10,spec.attrs);
      return ret;
    }
  }
);
  jdbc.update("String_Node_Str",jobId);
  jdbc.update("String_Node_Str",jobId);
  jdbc.update("String_Node_Str",jobId);
  final JobE job=new JobE();
  job.setJobId(jobId);
  job.setProjectId(project.getProjectId());
  job.setFolderId(null);
  job.setName(spec.getName());
  return job;
}
Program: 87219
Project: 87219
Buggy source:
@Override public Layer create(final Job job,final LayerSpecT layer,final int order){
  final UUID id=UUID.randomUUID();
  jdbc.update(new PreparedStatementCreator(){
    @Override public PreparedStatement createPreparedStatement(    final Connection conn) throws SQLException {
      final PreparedStatement ret=conn.prepareStatement(INSERT);
      ret.setObject(1,id);
      ret.setObject(2,job.getJobId());
      ret.setString(3,layer.getName());
      ret.setString(4,layer.getRange());
      ret.setArray(5,conn.createArrayOf("String_Node_Str",layer.getCommand().toArray()));
      ret.setArray(6,conn.createArrayOf("String_Node_Str",layer.getTags().toArray()));
      ret.setInt(7,layer.getChunk());
      ret.setInt(8,order);
      ret.setInt(9,layer.getMinCores());
      ret.setInt(10,layer.getMaxCores());
      ret.setInt(11,layer.getMinRamMb());
      ret.setBoolean(12,layer.isThreadable());
      return ret;
    }
  }
);
  jdbc.update("String_Node_Str",id);
  jdbc.update("String_Node_Str",id);
  jdbc.update("String_Node_Str",id);
  final LayerE result=new LayerE();
  result.setLayerId(id);
  result.setJobId(job.getJobId());
  return result;
}

Fixed version (ground truth):
@Override public Layer create(final Job job,final LayerSpecT layer,final int order){
  final UUID id=UUID.randomUUID();
  jdbc.update(new PreparedStatementCreator(){
    @Override public PreparedStatement createPreparedStatement(    final Connection conn) throws SQLException {
      final PreparedStatement ret=conn.prepareStatement(INSERT);
      ret.setObject(1,id);
      ret.setObject(2,job.getJobId());
      ret.setString(3,layer.getName());
      ret.setString(4,layer.getRange());
      ret.setArray(5,conn.createArrayOf("String_Node_Str",layer.getCommand().toArray()));
      ret.setArray(6,conn.createArrayOf("String_Node_Str",layer.getTags().toArray()));
      ret.setInt(7,layer.getChunk());
      ret.setInt(8,order);
      ret.setInt(9,layer.getMinCores());
      ret.setInt(10,layer.getMaxCores());
      ret.setInt(11,layer.getMinRamMb());
      ret.setBoolean(12,layer.isThreadable());
      return ret;
    }
  }
);
  jdbc.update("String_Node_Str",id);
  jdbc.update("String_Node_Str",id);
  jdbc.update("String_Node_Str",id);
  final LayerE result=new LayerE();
  result.setLayerId(id);
  result.setJobId(job.getJobId());
  result.setName(layer.getName());
  return result;
}
Program: 87220
Project: 87220
Buggy source:
@Override public Task create(Layer layer,String name,int number,int taskOrder,int layerOrder){
  final UUID id=UUID.randomUUID();
  jdbc.update(INSERT,id,layer.getLayerId(),layer.getJobId(),name,number,taskOrder,layerOrder,TaskState.INITIALIZE.ordinal());
  jdbc.update("String_Node_Str",id);
  TaskE task=new TaskE();
  task.setTaskId(id);
  task.setLayerId(layer.getLayerId());
  task.setJobId(layer.getJobId());
  return task;
}

Fixed version (ground truth):
@Override public Task create(Layer layer,String name,int number,int taskOrder,int layerOrder){
  final UUID id=UUID.randomUUID();
  jdbc.update(INSERT,id,layer.getLayerId(),layer.getJobId(),name,number,taskOrder,layerOrder,TaskState.INITIALIZE.ordinal());
  jdbc.update("String_Node_Str",id);
  TaskE task=new TaskE();
  task.setTaskId(id);
  task.setLayerId(layer.getLayerId());
  task.setJobId(layer.getJobId());
  task.setName(name);
  return task;
}
Program: 87221
Project: 87221
Buggy source:
@Override public void deallocateProc(DispatchProc proc,String why){
  if (proc == null) {
    return;
  }
  logger.info("String_Node_Str",proc.getProcId(),why);
  final Quota quota=quotaDao.getQuota(proc);
  quotaDao.freeResources(quota,proc.getIdleCores());
  final Node node=nodeDao.get(proc.getNodeId());
  nodeDao.freeResources(node,proc.getIdleCores(),proc.getIdleRam());
  dispatchDao.decrementDispatchTotals(proc);
  if (!procDao.delete(proc)) {
    logger.warn("String_Node_Str",proc.getProcId());
  }
  eventManager.post(new ProcDeallocatedEvent(proc));
}

Fixed version (ground truth):
@Override public void deallocateProc(DispatchProc proc,String why){
  if (proc == null) {
    return;
  }
  logger.info("String_Node_Str",proc.getProcId(),why);
  final Quota quota=quotaDao.getQuota(proc);
  final Node node=nodeDao.get(proc.getNodeId());
  if (procDao.delete(proc)) {
    quotaDao.freeResources(quota,proc.getIdleCores());
    nodeDao.freeResources(node,proc.getIdleCores(),proc.getIdleRam());
    dispatchDao.decrementDispatchTotals(proc);
  }
 else {
    logger.warn("String_Node_Str",proc.getProcId());
  }
  eventManager.post(new ProcDeallocatedEvent(proc));
}
Program: 87222
Project: 87222
Buggy source:
@Override public DispatchProc allocateProc(DispatchNode node,DispatchableTask task){
  final Quota quota=quotaDao.getQuota(node,task);
  if (!quotaDao.allocateResources(quota,task.minCores)) {
    logger.info("String_Node_Str");
    return null;
  }
  if (!nodeDao.allocateResources(node,task.minCores,task.minRam)) {
    logger.info("String_Node_Str" + node.getName());
    return null;
  }
  DispatchProc proc=procDao.create(node,task);
  dispatchDao.incrementDispatchTotals(proc);
  eventManager.post(new ProcAllocatedEvent(proc));
  return proc;
}

Fixed version (ground truth):
@Override public DispatchProc allocateProc(DispatchNode node,DispatchableTask task){
  DispatchProc proc=procDao.create(node,task);
  final Quota quota=quotaDao.getQuota(node,task);
  if (!quotaDao.allocateResources(quota,task.minCores)) {
    logger.info("String_Node_Str");
    return null;
  }
  if (!nodeDao.allocateResources(node,task.minCores,task.minRam)) {
    logger.info("String_Node_Str" + node.getName());
    return null;
  }
  dispatchDao.incrementDispatchTotals(proc);
  eventManager.post(new ProcAllocatedEvent(proc));
  return proc;
}
Program: 87223
Project: 87223
Buggy source:
@Override public boolean allocateResources(Node node,int cores,int memory){
  if (jdbc.update(ALLOCATE_RESOURCES,cores,memory,cores,memory,node.getNodeId()) != 1) {
    return true;
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean allocateResources(Node node,int cores,int memory){
  if (jdbc.update(ALLOCATE_RESOURCES,cores,memory,cores,memory,node.getNodeId()) == 1) {
    return true;
  }
  return false;
}
Program: 87224
Project: 87224
Buggy source:
@Override public void incrementDispatchTotals(DispatchProc proc){
  jdbc.update("String_Node_Str" + "String_Node_Str",proc.getIdleCores(),proc.getJobId());
  jdbc.update("String_Node_Str",proc.getIdleCores(),proc.getJobId());
  jdbc.update("String_Node_Str","String_Node_Str",proc.getIdleCores(),proc.getTaskId());
}

Fixed version (ground truth):
@Override public void incrementDispatchTotals(DispatchProc proc){
  jdbc.update("String_Node_Str" + "String_Node_Str",proc.getIdleCores(),proc.getJobId());
  jdbc.update("String_Node_Str",proc.getIdleCores(),proc.getJobId());
  jdbc.update("String_Node_Str" + "String_Node_Str",proc.getIdleCores(),proc.getTaskId());
}
Program: 87225
Project: 87225
Buggy source:
@Override public void decrementDispatchTotals(DispatchProc proc){
  jdbc.update("String_Node_Str" + "String_Node_Str",proc.getIdleCores(),proc.getJobId());
  jdbc.update("String_Node_Str",proc.getIdleCores(),proc.getJobId());
  jdbc.update("String_Node_Str","String_Node_Str",proc.getIdleCores(),proc.getTaskId());
}

Fixed version (ground truth):
@Override public void decrementDispatchTotals(DispatchProc proc){
  jdbc.update("String_Node_Str" + "String_Node_Str",proc.getIdleCores(),proc.getJobId());
  jdbc.update("String_Node_Str",proc.getIdleCores(),proc.getJobId());
  jdbc.update("String_Node_Str" + "String_Node_Str",proc.getIdleCores(),proc.getTaskId());
}
Program: 87227
Project: 87227
Buggy source:
@Test public void testGetDispatchNode(){
}

Fixed version (ground truth):
@Test public void testGetDispatchNode(){
  DispatchNode dnode=dispatchDao.getDispatchNode(node.getName());
}
Program: 87228
Project: 87228
Buggy source:
@Test public void testGetDispatchFolder(){
  Folder folder=folderDao.getDefaultFolder(TEST_PROJECT);
  DispatchFolder dfolder=dispatchDao.getDispatchFolder(folder.getFolderId());
  assertEquals(folder.getFolderId(),dfolder.getFolderId());
  assertEquals(0,dfolder.getRunCores());
  assertEquals(-1,dfolder.getMinCores());
  assertEquals(-1,dfolder.getMaxCores());
}

Fixed version (ground truth):
@Test public void testGetDispatchFolder(){
  Folder folder=folderDao.getDefaultFolder(TEST_PROJECT);
  DispatchableFolder dfolder=dispatchDao.getDispatchableFolder(folder.getFolderId());
}
Program: 87229
Project: 87229
Buggy source:
@Test public void testSortedProjects(){
  List<DispatchProject> projects=dispatchDao.getSortedProjectList(node);
  for (  DispatchProject project : projects) {
    logger.info(project.getProjectId());
  }
  assertEquals(1,projects.size());
}

Fixed version (ground truth):
@Test public void testSortedProjects(){
  List<DispatchProject> projects=dispatchDao.getSortedProjectList(node);
  assertEquals(1,projects.size());
}