nus-yam/ex-repair huggingface dataset:
Program: 61853
Project: 61853
Buggy source:
Collection<File> adjacentNFiles(File path,int count,boolean next){
  path=next ? nextPath(path) : previousPath(path);
  if (path == null)   return new ArrayList<>(0);
  File hourPath=SpokePathUtil.hourPathFolder(path);
  Collection<File> hourFiles=filesInBucket(hourPath,SpokePathUtil.second(path.getAbsolutePath()));
  File[] hourFileArray=new File[hourFiles.size()];
  hourFileArray=hourFiles.toArray(hourFileArray);
  Arrays.sort(hourFileArray);
  File[] adjacentFiles;
  int i=Arrays.binarySearch(hourFileArray,path);
  if (next) {
    int nextCompliment=hourFileArray.length - i;
    int to=nextCompliment > count ? i + count : hourFileArray.length - 1;
    to=to == i ? to + 1 : to;
    adjacentFiles=Arrays.copyOfRange(hourFileArray,i,to);
  }
 else {
    int from=i < count ? 0 : i - count;
    i=from == i ? i + 1 : i;
    adjacentFiles=Arrays.copyOfRange(hourFileArray,from,i);
  }
  Arrays.sort(adjacentFiles);
  ArrayList<File> result=new ArrayList<>();
  List<File> temp=Arrays.asList((File[])adjacentFiles);
  result.addAll(temp);
  if (adjacentFiles.length == count)   return result;
  File nextPath=next ? Iterables.getLast(result,null) : Iterables.getFirst(result,null);
  result.addAll(adjacentNFiles(nextPath,count - result.size(),next));
  return result;
}

Fixed version (ground truth):
Collection<File> adjacentNFiles(File path,int count,boolean next){
  String key=spokeKeyFromFile(path);
  key=next ? nextPath(key) : previousPath(key);
  if (key == null)   return new ArrayList<>(0);
  File hourPath=SpokePathUtil.hourPathFolder(spokeFilePathPart(key));
  Collection<File> hourFiles=filesInBucket(hourPath,SpokePathUtil.second(path.getAbsolutePath()));
  File[] hourFileArray=new File[hourFiles.size()];
  hourFileArray=hourFiles.toArray(hourFileArray);
  Arrays.sort(hourFileArray);
  File[] adjacentFiles;
  File searchForThisFile=spokeFilePathPart(key);
  int i=Arrays.binarySearch(hourFileArray,searchForThisFile);
  if (next) {
    int nextCompliment=hourFileArray.length - i;
    int to=nextCompliment > count ? i + count : hourFileArray.length - 1;
    to=to == i ? to + 1 : to;
    adjacentFiles=Arrays.copyOfRange(hourFileArray,i,to);
  }
 else {
    int from=i < count ? 0 : i - count;
    i=from == i ? i + 1 : i;
    adjacentFiles=Arrays.copyOfRange(hourFileArray,from,i);
  }
  Arrays.sort(adjacentFiles);
  ArrayList<File> result=new ArrayList<>();
  List<File> temp=Arrays.asList((File[])adjacentFiles);
  result.addAll(temp);
  if (adjacentFiles.length == count)   return result;
  File nextPath=next ? Iterables.getLast(result,null) : Iterables.getFirst(result,null);
  result.addAll(adjacentNFiles(nextPath,count - result.size(),next));
  return result;
}
Program: 61854
Project: 61854
Buggy source:
public String previousPath(String path){
  return spokeKeyFromFile(previousPath(spokeFilePathPart(path)));
}

Fixed version (ground truth):
String previousPath(String path){
  return adjacentPath(path,false);
}
Program: 61855
Project: 61855
Buggy source:
public String nextPath(String path){
  return spokeKeyFromFile(nextPath(spokeFilePathPart(path)));
}

Fixed version (ground truth):
String nextPath(String path){
  return adjacentPath(path,true);
}
Program: 61857
Project: 61857
Buggy source:
File adjacentPath(File file,boolean findNext){
  String parentPath=file.getParent();
  File parentFolder=new File(parentPath).getAbsoluteFile();
  File[] files=parentFolder.listFiles();
  if (files == null || files.length == 0)   return null;
  Arrays.sort(files);
  int i=Arrays.binarySearch(files,file);
  File nextPath;
  if (findNext) {
    if (i + 1 < files.length) {
      nextPath=files[i + 1];
    }
 else {
      File adjacentParent=nextPath(parentFolder);
      nextPath=nthFileInFolder(adjacentParent,0);
    }
  }
 else {
    if (i > 0) {
      nextPath=files[i - 1];
    }
 else {
      File adjacentParent=previousPath(parentFolder);
      nextPath=nthFileInFolder(adjacentParent,-1);
    }
  }
  return nextPath;
}

Fixed version (ground truth):
String adjacentPath(String keyPart,boolean findNext){
  File file=spokeFilePathPart(keyPart);
  File parentFolder=file.getParentFile();
  String parentKey=spokeKeyFromFile(parentFolder);
  File[] files=parentFolder.listFiles();
  if (files == null || files.length == 0)   return null;
  Arrays.sort(files);
  int i=Arrays.binarySearch(files,file);
  File nextPath;
  if (findNext) {
    if (i + 1 < files.length) {
      nextPath=files[i + 1];
    }
 else {
      File adjacentParent=spokeFilePathPart(nextPath(parentKey));
      nextPath=nthFileInFolder(adjacentParent,0);
    }
  }
 else {
    if (i > 0) {
      nextPath=files[i - 1];
    }
 else {
      File adjacentParent=spokeFilePathPart(previousPath(parentKey));
      nextPath=nthFileInFolder(adjacentParent,-1);
    }
  }
  return spokeKeyFromFile(nextPath);
}
Program: 61858
Project: 61858
Buggy source:
Collection<File> adjacentNFiles(File path,int count,boolean next){
  path=next ? nextPath(path) : previousPath(path);
  if (path == null)   return new ArrayList<>(0);
  File hourPath=SpokePathUtil.hourPathFolder(path);
  Collection<File> hourFiles=filesInBucket(hourPath,SpokePathUtil.second(path.getAbsolutePath()));
  File[] hourFileArray=new File[hourFiles.size()];
  hourFileArray=hourFiles.toArray(hourFileArray);
  Arrays.sort(hourFileArray);
  File[] adjacentFiles;
  int i=Arrays.binarySearch(hourFileArray,path);
  if (next) {
    int nextCompliment=hourFileArray.length - i;
    int to=nextCompliment > count ? i + count : hourFileArray.length - 1;
    to=to == i ? to + 1 : to;
    adjacentFiles=Arrays.copyOfRange(hourFileArray,i,to);
  }
 else {
    int from=i < count ? 0 : i - count;
    i=from == i ? i + 1 : i;
    adjacentFiles=Arrays.copyOfRange(hourFileArray,from,i);
  }
  Arrays.sort(adjacentFiles);
  ArrayList<File> result=new ArrayList<>();
  List<File> temp=Arrays.asList((File[])adjacentFiles);
  result.addAll(temp);
  if (adjacentFiles.length == count)   return result;
  File nextPath=next ? Iterables.getLast(result,null) : Iterables.getFirst(result,null);
  result.addAll(adjacentNFiles(nextPath,count - result.size(),next));
  return result;
}

Fixed version (ground truth):
Collection<File> adjacentNFiles(File path,int count,boolean next){
  String key=spokeKeyFromFile(path);
  key=next ? nextPath(key) : previousPath(key);
  if (key == null)   return new ArrayList<>(0);
  File hourPath=SpokePathUtil.hourPathFolder(spokeFilePathPart(key));
  Collection<File> hourFiles=filesInBucket(hourPath,SpokePathUtil.second(path.getAbsolutePath()));
  File[] hourFileArray=new File[hourFiles.size()];
  hourFileArray=hourFiles.toArray(hourFileArray);
  Arrays.sort(hourFileArray);
  File[] adjacentFiles;
  File searchForThisFile=spokeFilePathPart(key);
  int i=Arrays.binarySearch(hourFileArray,searchForThisFile);
  if (next) {
    int nextCompliment=hourFileArray.length - i;
    int to=nextCompliment > count ? i + count : hourFileArray.length - 1;
    to=to == i ? to + 1 : to;
    adjacentFiles=Arrays.copyOfRange(hourFileArray,i,to);
  }
 else {
    int from=i < count ? 0 : i - count;
    i=from == i ? i + 1 : i;
    adjacentFiles=Arrays.copyOfRange(hourFileArray,from,i);
  }
  Arrays.sort(adjacentFiles);
  ArrayList<File> result=new ArrayList<>();
  List<File> temp=Arrays.asList((File[])adjacentFiles);
  result.addAll(temp);
  if (adjacentFiles.length == count)   return result;
  File nextPath=next ? Iterables.getLast(result,null) : Iterables.getFirst(result,null);
  result.addAll(adjacentNFiles(nextPath,count - result.size(),next));
  return result;
}
Program: 61859
Project: 61859
Buggy source:
public String previousPath(String path){
  return spokeKeyFromFile(previousPath(spokeFilePathPart(path)));
}

Fixed version (ground truth):
String previousPath(String path){
  return adjacentPath(path,false);
}
Program: 61860
Project: 61860
Buggy source:
public String nextPath(String path){
  return spokeKeyFromFile(nextPath(spokeFilePathPart(path)));
}

Fixed version (ground truth):
String nextPath(String path){
  return adjacentPath(path,true);
}
Program: 61862
Project: 61862
Buggy source:
File adjacentPath(File file,boolean findNext){
  String parentPath=file.getParent();
  File parentFolder=new File(parentPath).getAbsoluteFile();
  File[] files=parentFolder.listFiles();
  if (files == null || files.length == 0)   return null;
  Arrays.sort(files);
  int i=Arrays.binarySearch(files,file);
  File nextPath;
  if (findNext) {
    if (i + 1 < files.length) {
      nextPath=files[i + 1];
    }
 else {
      File adjacentParent=nextPath(parentFolder);
      nextPath=nthFileInFolder(adjacentParent,0);
    }
  }
 else {
    if (i > 0) {
      nextPath=files[i - 1];
    }
 else {
      File adjacentParent=previousPath(parentFolder);
      nextPath=nthFileInFolder(adjacentParent,-1);
    }
  }
  return nextPath;
}

Fixed version (ground truth):
String adjacentPath(String keyPart,boolean findNext){
  File file=spokeFilePathPart(keyPart);
  File parentFolder=file.getParentFile();
  String parentKey=spokeKeyFromFile(parentFolder);
  File[] files=parentFolder.listFiles();
  if (files == null || files.length == 0)   return null;
  Arrays.sort(files);
  int i=Arrays.binarySearch(files,file);
  File nextPath;
  if (findNext) {
    if (i + 1 < files.length) {
      nextPath=files[i + 1];
    }
 else {
      File adjacentParent=spokeFilePathPart(nextPath(parentKey));
      nextPath=nthFileInFolder(adjacentParent,0);
    }
  }
 else {
    if (i > 0) {
      nextPath=files[i - 1];
    }
 else {
      File adjacentParent=spokeFilePathPart(previousPath(parentKey));
      nextPath=nthFileInFolder(adjacentParent,-1);
    }
  }
  return spokeKeyFromFile(nextPath);
}
Program: 61863
Project: 61863
Buggy source:
Collection<File> adjacentNFiles(File path,int count,boolean next){
  path=next ? nextPath(path) : previousPath(path);
  if (path == null)   return new ArrayList<>(0);
  File hourPath=SpokePathUtil.hourPathFolder(path);
  Collection<File> hourFiles=filesInBucket(hourPath,SpokePathUtil.second(path.getAbsolutePath()));
  File[] hourFileArray=new File[hourFiles.size()];
  hourFileArray=hourFiles.toArray(hourFileArray);
  Arrays.sort(hourFileArray);
  File[] adjacentFiles;
  int i=Arrays.binarySearch(hourFileArray,path);
  if (next) {
    int nextCompliment=hourFileArray.length - i;
    int to=nextCompliment > count ? i + count : hourFileArray.length - 1;
    to=to == i ? to + 1 : to;
    adjacentFiles=Arrays.copyOfRange(hourFileArray,i,to);
  }
 else {
    int from=i < count ? 0 : i - count;
    i=from == i ? i + 1 : i;
    adjacentFiles=Arrays.copyOfRange(hourFileArray,from,i);
  }
  Arrays.sort(adjacentFiles);
  ArrayList<File> result=new ArrayList<>();
  List<File> temp=Arrays.asList((File[])adjacentFiles);
  result.addAll(temp);
  if (adjacentFiles.length == count)   return result;
  File nextPath=next ? Iterables.getLast(result,null) : Iterables.getFirst(result,null);
  result.addAll(adjacentNFiles(nextPath,count - result.size(),next));
  return result;
}

Fixed version (ground truth):
Collection<File> adjacentNFiles(File path,int count,boolean next){
  String key=spokeKeyFromFile(path);
  key=next ? nextPath(key) : previousPath(key);
  if (key == null)   return new ArrayList<>(0);
  File hourPath=SpokePathUtil.hourPathFolder(spokeFilePathPart(key));
  Collection<File> hourFiles=filesInBucket(hourPath,SpokePathUtil.second(path.getAbsolutePath()));
  File[] hourFileArray=new File[hourFiles.size()];
  hourFileArray=hourFiles.toArray(hourFileArray);
  Arrays.sort(hourFileArray);
  File[] adjacentFiles;
  File searchForThisFile=spokeFilePathPart(key);
  int i=Arrays.binarySearch(hourFileArray,searchForThisFile);
  if (next) {
    int nextCompliment=hourFileArray.length - i;
    int to=nextCompliment > count ? i + count : hourFileArray.length - 1;
    to=to == i ? to + 1 : to;
    adjacentFiles=Arrays.copyOfRange(hourFileArray,i,to);
  }
 else {
    int from=i < count ? 0 : i - count;
    i=from == i ? i + 1 : i;
    adjacentFiles=Arrays.copyOfRange(hourFileArray,from,i);
  }
  Arrays.sort(adjacentFiles);
  ArrayList<File> result=new ArrayList<>();
  List<File> temp=Arrays.asList((File[])adjacentFiles);
  result.addAll(temp);
  if (adjacentFiles.length == count)   return result;
  File nextPath=next ? Iterables.getLast(result,null) : Iterables.getFirst(result,null);
  result.addAll(adjacentNFiles(nextPath,count - result.size(),next));
  return result;
}
Program: 61864
Project: 61864
Buggy source:
public String previousPath(String path){
  return spokeKeyFromFile(previousPath(spokeFilePathPart(path)));
}

Fixed version (ground truth):
String previousPath(String path){
  return adjacentPath(path,false);
}
Program: 61865
Project: 61865
Buggy source:
public String nextPath(String path){
  return spokeKeyFromFile(nextPath(spokeFilePathPart(path)));
}

Fixed version (ground truth):
String nextPath(String path){
  return adjacentPath(path,true);
}
Program: 61867
Project: 61867
Buggy source:
File adjacentPath(File file,boolean findNext){
  String parentPath=file.getParent();
  File parentFolder=new File(parentPath).getAbsoluteFile();
  File[] files=parentFolder.listFiles();
  if (files == null || files.length == 0)   return null;
  Arrays.sort(files);
  int i=Arrays.binarySearch(files,file);
  File nextPath;
  if (findNext) {
    if (i + 1 < files.length) {
      nextPath=files[i + 1];
    }
 else {
      File adjacentParent=nextPath(parentFolder);
      nextPath=nthFileInFolder(adjacentParent,0);
    }
  }
 else {
    if (i > 0) {
      nextPath=files[i - 1];
    }
 else {
      File adjacentParent=previousPath(parentFolder);
      nextPath=nthFileInFolder(adjacentParent,-1);
    }
  }
  return nextPath;
}

Fixed version (ground truth):
String adjacentPath(String keyPart,boolean findNext){
  File file=spokeFilePathPart(keyPart);
  File parentFolder=file.getParentFile();
  String parentKey=spokeKeyFromFile(parentFolder);
  File[] files=parentFolder.listFiles();
  if (files == null || files.length == 0)   return null;
  Arrays.sort(files);
  int i=Arrays.binarySearch(files,file);
  File nextPath;
  if (findNext) {
    if (i + 1 < files.length) {
      nextPath=files[i + 1];
    }
 else {
      File adjacentParent=spokeFilePathPart(nextPath(parentKey));
      nextPath=nthFileInFolder(adjacentParent,0);
    }
  }
 else {
    if (i > 0) {
      nextPath=files[i - 1];
    }
 else {
      File adjacentParent=spokeFilePathPart(previousPath(parentKey));
      nextPath=nthFileInFolder(adjacentParent,-1);
    }
  }
  return spokeKeyFromFile(nextPath);
}
Program: 61868
Project: 61868
Buggy source:
Collection<File> adjacentNFiles(File path,int count,boolean next){
  path=next ? nextPath(path) : previousPath(path);
  if (path == null)   return new ArrayList<>(0);
  File hourPath=SpokePathUtil.hourPathFolder(path);
  Collection<File> hourFiles=filesInBucket(hourPath,SpokePathUtil.second(path.getAbsolutePath()));
  File[] hourFileArray=new File[hourFiles.size()];
  hourFileArray=hourFiles.toArray(hourFileArray);
  Arrays.sort(hourFileArray);
  File[] adjacentFiles;
  int i=Arrays.binarySearch(hourFileArray,path);
  if (next) {
    int nextCompliment=hourFileArray.length - i;
    int to=nextCompliment > count ? i + count : hourFileArray.length - 1;
    to=to == i ? to + 1 : to;
    adjacentFiles=Arrays.copyOfRange(hourFileArray,i,to);
  }
 else {
    int from=i < count ? 0 : i - count;
    i=from == i ? i + 1 : i;
    adjacentFiles=Arrays.copyOfRange(hourFileArray,from,i);
  }
  Arrays.sort(adjacentFiles);
  ArrayList<File> result=new ArrayList<>();
  List<File> temp=Arrays.asList((File[])adjacentFiles);
  result.addAll(temp);
  if (adjacentFiles.length == count)   return result;
  File nextPath=next ? Iterables.getLast(result,null) : Iterables.getFirst(result,null);
  result.addAll(adjacentNFiles(nextPath,count - result.size(),next));
  return result;
}

Fixed version (ground truth):
Collection<File> adjacentNFiles(File path,int count,boolean next){
  String key=spokeKeyFromFile(path);
  key=next ? nextPath(key) : previousPath(key);
  if (key == null)   return new ArrayList<>(0);
  File hourPath=SpokePathUtil.hourPathFolder(spokeFilePathPart(key));
  Collection<File> hourFiles=filesInBucket(hourPath,SpokePathUtil.second(path.getAbsolutePath()));
  File[] hourFileArray=new File[hourFiles.size()];
  hourFileArray=hourFiles.toArray(hourFileArray);
  Arrays.sort(hourFileArray);
  File[] adjacentFiles;
  File searchForThisFile=spokeFilePathPart(key);
  int i=Arrays.binarySearch(hourFileArray,searchForThisFile);
  if (next) {
    int nextCompliment=hourFileArray.length - i;
    int to=nextCompliment > count ? i + count : hourFileArray.length - 1;
    to=to == i ? to + 1 : to;
    adjacentFiles=Arrays.copyOfRange(hourFileArray,i,to);
  }
 else {
    int from=i < count ? 0 : i - count;
    i=from == i ? i + 1 : i;
    adjacentFiles=Arrays.copyOfRange(hourFileArray,from,i);
  }
  Arrays.sort(adjacentFiles);
  ArrayList<File> result=new ArrayList<>();
  List<File> temp=Arrays.asList((File[])adjacentFiles);
  result.addAll(temp);
  if (adjacentFiles.length == count)   return result;
  File nextPath=next ? Iterables.getLast(result,null) : Iterables.getFirst(result,null);
  result.addAll(adjacentNFiles(nextPath,count - result.size(),next));
  return result;
}
Program: 61869
Project: 61869
Buggy source:
public String previousPath(String path){
  return spokeKeyFromFile(previousPath(spokeFilePathPart(path)));
}

Fixed version (ground truth):
String previousPath(String path){
  return adjacentPath(path,false);
}
Program: 61870
Project: 61870
Buggy source:
public String nextPath(String path){
  return spokeKeyFromFile(nextPath(spokeFilePathPart(path)));
}

Fixed version (ground truth):
String nextPath(String path){
  return adjacentPath(path,true);
}
Program: 61872
Project: 61872
Buggy source:
File adjacentPath(File file,boolean findNext){
  String parentPath=file.getParent();
  File parentFolder=new File(parentPath).getAbsoluteFile();
  File[] files=parentFolder.listFiles();
  if (files == null || files.length == 0)   return null;
  Arrays.sort(files);
  int i=Arrays.binarySearch(files,file);
  File nextPath;
  if (findNext) {
    if (i + 1 < files.length) {
      nextPath=files[i + 1];
    }
 else {
      File adjacentParent=nextPath(parentFolder);
      nextPath=nthFileInFolder(adjacentParent,0);
    }
  }
 else {
    if (i > 0) {
      nextPath=files[i - 1];
    }
 else {
      File adjacentParent=previousPath(parentFolder);
      nextPath=nthFileInFolder(adjacentParent,-1);
    }
  }
  return nextPath;
}

Fixed version (ground truth):
String adjacentPath(String keyPart,boolean findNext){
  File file=spokeFilePathPart(keyPart);
  File parentFolder=file.getParentFile();
  String parentKey=spokeKeyFromFile(parentFolder);
  File[] files=parentFolder.listFiles();
  if (files == null || files.length == 0)   return null;
  Arrays.sort(files);
  int i=Arrays.binarySearch(files,file);
  File nextPath;
  if (findNext) {
    if (i + 1 < files.length) {
      nextPath=files[i + 1];
    }
 else {
      File adjacentParent=spokeFilePathPart(nextPath(parentKey));
      nextPath=nthFileInFolder(adjacentParent,0);
    }
  }
 else {
    if (i > 0) {
      nextPath=files[i - 1];
    }
 else {
      File adjacentParent=spokeFilePathPart(previousPath(parentKey));
      nextPath=nthFileInFolder(adjacentParent,-1);
    }
  }
  return spokeKeyFromFile(nextPath);
}
Program: 61873
Project: 61873
Buggy source:
Collection<File> adjacentNFiles(File path,int count,boolean next){
  path=next ? nextPath(path) : previousPath(path);
  if (path == null)   return new ArrayList<>(0);
  File hourPath=SpokePathUtil.hourPathFolder(path);
  Collection<File> hourFiles=filesInBucket(hourPath,SpokePathUtil.second(path.getAbsolutePath()));
  File[] hourFileArray=new File[hourFiles.size()];
  hourFileArray=hourFiles.toArray(hourFileArray);
  Arrays.sort(hourFileArray);
  File[] adjacentFiles;
  int i=Arrays.binarySearch(hourFileArray,path);
  if (next) {
    int nextCompliment=hourFileArray.length - i;
    int to=nextCompliment > count ? i + count : hourFileArray.length - 1;
    to=to == i ? to + 1 : to;
    adjacentFiles=Arrays.copyOfRange(hourFileArray,i,to);
  }
 else {
    int from=i < count ? 0 : i - count;
    i=from == i ? i + 1 : i;
    adjacentFiles=Arrays.copyOfRange(hourFileArray,from,i);
  }
  Arrays.sort(adjacentFiles);
  ArrayList<File> result=new ArrayList<>();
  List<File> temp=Arrays.asList((File[])adjacentFiles);
  result.addAll(temp);
  if (adjacentFiles.length == count)   return result;
  File nextPath=next ? Iterables.getLast(result,null) : Iterables.getFirst(result,null);
  result.addAll(adjacentNFiles(nextPath,count - result.size(),next));
  return result;
}

Fixed version (ground truth):
Collection<File> adjacentNFiles(File path,int count,boolean next){
  String key=spokeKeyFromFile(path);
  key=next ? nextPath(key) : previousPath(key);
  if (key == null)   return new ArrayList<>(0);
  File hourPath=SpokePathUtil.hourPathFolder(spokeFilePathPart(key));
  Collection<File> hourFiles=filesInBucket(hourPath,SpokePathUtil.second(path.getAbsolutePath()));
  File[] hourFileArray=new File[hourFiles.size()];
  hourFileArray=hourFiles.toArray(hourFileArray);
  Arrays.sort(hourFileArray);
  File[] adjacentFiles;
  File searchForThisFile=spokeFilePathPart(key);
  int i=Arrays.binarySearch(hourFileArray,searchForThisFile);
  if (next) {
    int nextCompliment=hourFileArray.length - i;
    int to=nextCompliment > count ? i + count : hourFileArray.length - 1;
    to=to == i ? to + 1 : to;
    adjacentFiles=Arrays.copyOfRange(hourFileArray,i,to);
  }
 else {
    int from=i < count ? 0 : i - count;
    i=from == i ? i + 1 : i;
    adjacentFiles=Arrays.copyOfRange(hourFileArray,from,i);
  }
  Arrays.sort(adjacentFiles);
  ArrayList<File> result=new ArrayList<>();
  List<File> temp=Arrays.asList((File[])adjacentFiles);
  result.addAll(temp);
  if (adjacentFiles.length == count)   return result;
  File nextPath=next ? Iterables.getLast(result,null) : Iterables.getFirst(result,null);
  result.addAll(adjacentNFiles(nextPath,count - result.size(),next));
  return result;
}
Program: 61874
Project: 61874
Buggy source:
public String previousPath(String path){
  return spokeKeyFromFile(previousPath(spokeFilePathPart(path)));
}

Fixed version (ground truth):
String previousPath(String path){
  return adjacentPath(path,false);
}
Program: 61875
Project: 61875
Buggy source:
public String nextPath(String path){
  return spokeKeyFromFile(nextPath(spokeFilePathPart(path)));
}

Fixed version (ground truth):
String nextPath(String path){
  return adjacentPath(path,true);
}
Program: 61877
Project: 61877
Buggy source:
@Override public void takeLeadership(AtomicBoolean hasLeadership){
  while (hasLeadership.get()) {
    DateTime lastTime=lastCompleted.get(getValuePath(),TimeUtil.now());
    Sleeper.sleep(getSleep(lastTime,TimeUtil.now()));
    DateTime nextTime=lastTime.plusMinutes(1);
    logger.debug("String_Node_Str",nextTime);
    Collection<ContentKey> contentKeys=cacheContentDao.queryByTime(channel,nextTime,TimeUtil.Unit.MINUTES);
    for (    ContentKey contentKey : contentKeys) {
      s3WriteQueue.add(new ChannelContentKey(channel,contentKey));
    }
    lastCompleted.update(getValuePath(),nextTime);
  }
}

Fixed version (ground truth):
@Override public void takeLeadership(AtomicBoolean hasLeadership){
  while (hasLeadership.get()) {
    DateTime nextTime=lastCompleted.get(getValuePath(),TimeUtil.now()).plusMinutes(1);
    Sleeper.sleep(getSleep(nextTime,TimeUtil.now()));
    logger.debug("String_Node_Str",nextTime);
    Collection<ContentKey> contentKeys=cacheContentDao.queryByTime(channel,nextTime,TimeUtil.Unit.MINUTES);
    for (    ContentKey contentKey : contentKeys) {
      s3WriteQueue.add(new ChannelContentKey(channel,contentKey));
    }
    lastCompleted.update(getValuePath(),nextTime);
  }
}
Program: 61878
Project: 61878
Buggy source:
@Override public void takeLeadership(AtomicBoolean hasLeadership){
  while (hasLeadership.get()) {
    DateTime lastTime=lastCompleted.get(getValuePath(),TimeUtil.now());
    Sleeper.sleep(getSleep(lastTime,TimeUtil.now()));
    DateTime nextTime=lastTime.plusMinutes(1);
    logger.debug("String_Node_Str",nextTime);
    Collection<ContentKey> contentKeys=cacheContentDao.queryByTime(channel,nextTime,TimeUtil.Unit.MINUTES);
    for (    ContentKey contentKey : contentKeys) {
      s3WriteQueue.add(new ChannelContentKey(channel,contentKey));
    }
    lastCompleted.update(getValuePath(),nextTime);
  }
}

Fixed version (ground truth):
@Override public void takeLeadership(AtomicBoolean hasLeadership){
  while (hasLeadership.get()) {
    DateTime nextTime=lastCompleted.get(getValuePath(),TimeUtil.now()).plusMinutes(1);
    Sleeper.sleep(getSleep(nextTime,TimeUtil.now()));
    logger.debug("String_Node_Str",nextTime);
    Collection<ContentKey> contentKeys=cacheContentDao.queryByTime(channel,nextTime,TimeUtil.Unit.MINUTES);
    for (    ContentKey contentKey : contentKeys) {
      s3WriteQueue.add(new ChannelContentKey(channel,contentKey));
    }
    lastCompleted.update(getValuePath(),nextTime);
  }
}
Program: 61879
Project: 61879
Buggy source:
@Override public void takeLeadership(AtomicBoolean hasLeadership){
  while (hasLeadership.get()) {
    DateTime lastTime=lastCompleted.get(getValuePath(),TimeUtil.now());
    Sleeper.sleep(getSleep(lastTime,TimeUtil.now()));
    DateTime nextTime=lastTime.plusMinutes(1);
    logger.debug("String_Node_Str",nextTime);
    Collection<ContentKey> contentKeys=cacheContentDao.queryByTime(channel,nextTime,TimeUtil.Unit.MINUTES);
    for (    ContentKey contentKey : contentKeys) {
      s3WriteQueue.add(new ChannelContentKey(channel,contentKey));
    }
    lastCompleted.update(getValuePath(),nextTime);
  }
}

Fixed version (ground truth):
@Override public void takeLeadership(AtomicBoolean hasLeadership){
  while (hasLeadership.get()) {
    DateTime nextTime=lastCompleted.get(getValuePath(),TimeUtil.now()).plusMinutes(1);
    Sleeper.sleep(getSleep(nextTime,TimeUtil.now()));
    logger.debug("String_Node_Str",nextTime);
    Collection<ContentKey> contentKeys=cacheContentDao.queryByTime(channel,nextTime,TimeUtil.Unit.MINUTES);
    for (    ContentKey contentKey : contentKeys) {
      s3WriteQueue.add(new ChannelContentKey(channel,contentKey));
    }
    lastCompleted.update(getValuePath(),nextTime);
  }
}
Program: 61880
Project: 61880
Buggy source:
@Path("String_Node_Str") @EventTimed(name="String_Node_Str") @PerChannelTimed(operationName="String_Node_Str",channelNameParameter="String_Node_Str",newName="String_Node_Str") @Produces(MediaType.APPLICATION_JSON) @GET public Response getMillis(@PathParam("String_Node_Str") String channelName,@PathParam("String_Node_Str") int year,@PathParam("String_Node_Str") int month,@PathParam("String_Node_Str") int day,@PathParam("String_Node_Str") int hour,@PathParam("String_Node_Str") int minute,@PathParam("String_Node_Str") int second,@PathParam("String_Node_Str") int millis){
  DateTime startTime=new DateTime(year,month,day,hour,minute,second,millis,DateTimeZone.UTC);
  Collection<ContentKey> keys=channelService.getKeys(channelName,startTime,startTime);
  return getResponse(channelName,TimeUtil.millis(startTime.minusMillis(1)),TimeUtil.millis(startTime.plusMillis(1)),keys);
}

Fixed version (ground truth):
@Path("String_Node_Str") @EventTimed(name="String_Node_Str") @PerChannelTimed(operationName="String_Node_Str",channelNameParameter="String_Node_Str") @Produces(MediaType.APPLICATION_JSON) @GET public Response getMillis(@PathParam("String_Node_Str") String channelName,@PathParam("String_Node_Str") int year,@PathParam("String_Node_Str") int month,@PathParam("String_Node_Str") int day,@PathParam("String_Node_Str") int hour,@PathParam("String_Node_Str") int minute,@PathParam("String_Node_Str") int second,@PathParam("String_Node_Str") int millis){
  DateTime startTime=new DateTime(year,month,day,hour,minute,second,millis,DateTimeZone.UTC);
  Collection<ContentKey> keys=channelService.getKeys(channelName,startTime,startTime);
  return getResponse(channelName,TimeUtil.millis(startTime.minusMillis(1)),TimeUtil.millis(startTime.plusMillis(1)),keys);
}
Program: 61881
Project: 61881
Buggy source:
@Path("String_Node_Str") @EventTimed(name="String_Node_Str") @PerChannelTimed(operationName="String_Node_Str",channelNameParameter="String_Node_Str",newName="String_Node_Str") @Produces(MediaType.APPLICATION_JSON) @GET public Response getMillis(@PathParam("String_Node_Str") String channelName,@PathParam("String_Node_Str") int year,@PathParam("String_Node_Str") int month,@PathParam("String_Node_Str") int day,@PathParam("String_Node_Str") int hour,@PathParam("String_Node_Str") int minute,@PathParam("String_Node_Str") int second,@PathParam("String_Node_Str") int millis){
  DateTime startTime=new DateTime(year,month,day,hour,minute,second,millis,DateTimeZone.UTC);
  Collection<ContentKey> keys=channelService.getKeys(channelName,startTime,startTime);
  return getResponse(channelName,TimeUtil.millis(startTime.minusMillis(1)),TimeUtil.millis(startTime.plusMillis(1)),keys);
}

Fixed version (ground truth):
@Path("String_Node_Str") @EventTimed(name="String_Node_Str") @PerChannelTimed(operationName="String_Node_Str",channelNameParameter="String_Node_Str") @Produces(MediaType.APPLICATION_JSON) @GET public Response getMillis(@PathParam("String_Node_Str") String channelName,@PathParam("String_Node_Str") int year,@PathParam("String_Node_Str") int month,@PathParam("String_Node_Str") int day,@PathParam("String_Node_Str") int hour,@PathParam("String_Node_Str") int minute,@PathParam("String_Node_Str") int second,@PathParam("String_Node_Str") int millis){
  DateTime startTime=new DateTime(year,month,day,hour,minute,second,millis,DateTimeZone.UTC);
  Collection<ContentKey> keys=channelService.getKeys(channelName,startTime,startTime);
  return getResponse(channelName,TimeUtil.millis(startTime.minusMillis(1)),TimeUtil.millis(startTime.plusMillis(1)),keys);
}
Program: 61882
Project: 61882
Buggy source:
@Path("String_Node_Str") @EventTimed(name="String_Node_Str") @PerChannelTimed(operationName="String_Node_Str",channelNameParameter="String_Node_Str",newName="String_Node_Str") @Produces(MediaType.APPLICATION_JSON) @GET public Response getMillis(@PathParam("String_Node_Str") String channelName,@PathParam("String_Node_Str") int year,@PathParam("String_Node_Str") int month,@PathParam("String_Node_Str") int day,@PathParam("String_Node_Str") int hour,@PathParam("String_Node_Str") int minute,@PathParam("String_Node_Str") int second,@PathParam("String_Node_Str") int millis){
  DateTime startTime=new DateTime(year,month,day,hour,minute,second,millis,DateTimeZone.UTC);
  Collection<ContentKey> keys=channelService.getKeys(channelName,startTime,startTime);
  return getResponse(channelName,TimeUtil.millis(startTime.minusMillis(1)),TimeUtil.millis(startTime.plusMillis(1)),keys);
}

Fixed version (ground truth):
@Path("String_Node_Str") @EventTimed(name="String_Node_Str") @PerChannelTimed(operationName="String_Node_Str",channelNameParameter="String_Node_Str") @Produces(MediaType.APPLICATION_JSON) @GET public Response getMillis(@PathParam("String_Node_Str") String channelName,@PathParam("String_Node_Str") int year,@PathParam("String_Node_Str") int month,@PathParam("String_Node_Str") int day,@PathParam("String_Node_Str") int hour,@PathParam("String_Node_Str") int minute,@PathParam("String_Node_Str") int second,@PathParam("String_Node_Str") int millis){
  DateTime startTime=new DateTime(year,month,day,hour,minute,second,millis,DateTimeZone.UTC);
  Collection<ContentKey> keys=channelService.getKeys(channelName,startTime,startTime);
  return getResponse(channelName,TimeUtil.millis(startTime.minusMillis(1)),TimeUtil.millis(startTime.plusMillis(1)),keys);
}
Program: 61883
Project: 61883
Buggy source:
private void makeCall(final ObjectNode response) throws ExecutionException, RetryException {
  retryer.call(new Callable<ClientResponse>(){
    @Override public ClientResponse call() throws Exception {
      if (!hasLeadership.get()) {
        logger.debug("String_Node_Str",group.getCallbackUrl(),group.getName(),response);
        return null;
      }
      logger.debug("String_Node_Str",group.getCallbackUrl(),group.getName(),response);
      return client.resource(group.getCallbackUrl()).type(MediaType.APPLICATION_JSON_TYPE).post(ClientResponse.class,response.toString());
    }
  }
);
}

Fixed version (ground truth):
private void makeCall(final ObjectNode response) throws ExecutionException, RetryException {
  retryer.call(new Callable<ClientResponse>(){
    @Override public ClientResponse call() throws Exception {
      if (!hasLeadership.get()) {
        logger.debug("String_Node_Str",group.getCallbackUrl(),group.getName(),response);
        return null;
      }
      logger.debug("String_Node_Str",group.getCallbackUrl(),response);
      return client.resource(group.getCallbackUrl()).type(MediaType.APPLICATION_JSON_TYPE).post(ClientResponse.class,response.toString());
    }
  }
);
}
Program: 61884
Project: 61884
Buggy source:
@Override public ClientResponse call() throws Exception {
  if (!hasLeadership.get()) {
    logger.debug("String_Node_Str",group.getCallbackUrl(),group.getName(),response);
    return null;
  }
  logger.debug("String_Node_Str",group.getCallbackUrl(),group.getName(),response);
  return client.resource(group.getCallbackUrl()).type(MediaType.APPLICATION_JSON_TYPE).post(ClientResponse.class,response.toString());
}

Fixed version (ground truth):
@Override public ClientResponse call() throws Exception {
  if (!hasLeadership.get()) {
    logger.debug("String_Node_Str",group.getCallbackUrl(),group.getName(),response);
    return null;
  }
  logger.debug("String_Node_Str",group.getCallbackUrl(),response);
  return client.resource(group.getCallbackUrl()).type(MediaType.APPLICATION_JSON_TYPE).post(ClientResponse.class,response.toString());
}
Program: 61885
Project: 61885
Buggy source:
private long sendInProcess(long lastCompletedId) throws InterruptedException {
  Set<Long> inProcessSet=inProcess.getSet();
  logger.debug("String_Node_Str",inProcessSet,group.getName());
  for (  Long toSend : inProcessSet) {
    if (toSend < lastCompletedId) {
      send(toSend);
    }
 else {
      inProcess.remove(toSend);
    }
  }
  return lastCompletedId;
}

Fixed version (ground truth):
private long sendInProcess(long lastCompletedId) throws InterruptedException {
  Set<Long> inProcessSet=inProcess.getSet();
  logger.trace("String_Node_Str",inProcessSet,group.getName());
  for (  Long toSend : inProcessSet) {
    if (toSend < lastCompletedId) {
      send(toSend);
    }
 else {
      inProcess.remove(toSend);
    }
  }
  return lastCompletedId;
}
Program: 61886
Project: 61886
Buggy source:
private void send(final long next) throws InterruptedException {
  logger.debug("String_Node_Str",next,group.getName());
  semaphore.acquire();
  executorService.submit(new Callable<Object>(){
    @Override public Object call() throws Exception {
      inProcess.add(next);
      try {
        makeTimedCall(createResponse(next));
        lastCompleted.updateIncrease(next,getValuePath());
        inProcess.remove(next);
        logger.debug("String_Node_Str",next,group.getName());
      }
 catch (      Exception e) {
        logger.warn("String_Node_Str" + next + "String_Node_Str"+ group.getName(),e);
      }
 finally {
        semaphore.release();
      }
      return null;
    }
  }
);
}

Fixed version (ground truth):
private void send(final long next) throws InterruptedException {
  logger.trace("String_Node_Str",next,group.getName());
  semaphore.acquire();
  executorService.submit(new Callable<Object>(){
    @Override public Object call() throws Exception {
      inProcess.add(next);
      try {
        makeTimedCall(createResponse(next));
        lastCompleted.updateIncrease(next,getValuePath());
        inProcess.remove(next);
        logger.trace("String_Node_Str",next,group.getName());
      }
 catch (      Exception e) {
        logger.warn("String_Node_Str" + next + "String_Node_Str"+ group.getName(),e);
      }
 finally {
        semaphore.release();
      }
      return null;
    }
  }
);
}
Program: 61887
Project: 61887
Buggy source:
private void makeCall(final ObjectNode response) throws ExecutionException, RetryException {
  retryer.call(new Callable<ClientResponse>(){
    @Override public ClientResponse call() throws Exception {
      if (!hasLeadership.get()) {
        logger.debug("String_Node_Str",group.getCallbackUrl(),group.getName(),response);
        return null;
      }
      logger.debug("String_Node_Str",group.getCallbackUrl(),group.getName(),response);
      return client.resource(group.getCallbackUrl()).type(MediaType.APPLICATION_JSON_TYPE).post(ClientResponse.class,response.toString());
    }
  }
);
}

Fixed version (ground truth):
private void makeCall(final ObjectNode response) throws ExecutionException, RetryException {
  retryer.call(new Callable<ClientResponse>(){
    @Override public ClientResponse call() throws Exception {
      if (!hasLeadership.get()) {
        logger.debug("String_Node_Str",group.getCallbackUrl(),group.getName(),response);
        return null;
      }
      logger.debug("String_Node_Str",group.getCallbackUrl(),response);
      return client.resource(group.getCallbackUrl()).type(MediaType.APPLICATION_JSON_TYPE).post(ClientResponse.class,response.toString());
    }
  }
);
}
Program: 61888
Project: 61888
Buggy source:
@Override public ClientResponse call() throws Exception {
  if (!hasLeadership.get()) {
    logger.debug("String_Node_Str",group.getCallbackUrl(),group.getName(),response);
    return null;
  }
  logger.debug("String_Node_Str",group.getCallbackUrl(),group.getName(),response);
  return client.resource(group.getCallbackUrl()).type(MediaType.APPLICATION_JSON_TYPE).post(ClientResponse.class,response.toString());
}

Fixed version (ground truth):
@Override public ClientResponse call() throws Exception {
  if (!hasLeadership.get()) {
    logger.debug("String_Node_Str",group.getCallbackUrl(),group.getName(),response);
    return null;
  }
  logger.debug("String_Node_Str",group.getCallbackUrl(),response);
  return client.resource(group.getCallbackUrl()).type(MediaType.APPLICATION_JSON_TYPE).post(ClientResponse.class,response.toString());
}
Program: 61889
Project: 61889
Buggy source:
private long sendInProcess(long lastCompletedId) throws InterruptedException {
  Set<Long> inProcessSet=inProcess.getSet();
  logger.debug("String_Node_Str",inProcessSet,group.getName());
  for (  Long toSend : inProcessSet) {
    if (toSend < lastCompletedId) {
      send(toSend);
    }
 else {
      inProcess.remove(toSend);
    }
  }
  return lastCompletedId;
}

Fixed version (ground truth):
private long sendInProcess(long lastCompletedId) throws InterruptedException {
  Set<Long> inProcessSet=inProcess.getSet();
  logger.trace("String_Node_Str",inProcessSet,group.getName());
  for (  Long toSend : inProcessSet) {
    if (toSend < lastCompletedId) {
      send(toSend);
    }
 else {
      inProcess.remove(toSend);
    }
  }
  return lastCompletedId;
}
Program: 61890
Project: 61890
Buggy source:
private void send(final long next) throws InterruptedException {
  logger.debug("String_Node_Str",next,group.getName());
  semaphore.acquire();
  executorService.submit(new Callable<Object>(){
    @Override public Object call() throws Exception {
      inProcess.add(next);
      try {
        makeTimedCall(createResponse(next));
        lastCompleted.updateIncrease(next,getValuePath());
        inProcess.remove(next);
        logger.debug("String_Node_Str",next,group.getName());
      }
 catch (      Exception e) {
        logger.warn("String_Node_Str" + next + "String_Node_Str"+ group.getName(),e);
      }
 finally {
        semaphore.release();
      }
      return null;
    }
  }
);
}

Fixed version (ground truth):
private void send(final long next) throws InterruptedException {
  logger.trace("String_Node_Str",next,group.getName());
  semaphore.acquire();
  executorService.submit(new Callable<Object>(){
    @Override public Object call() throws Exception {
      inProcess.add(next);
      try {
        makeTimedCall(createResponse(next));
        lastCompleted.updateIncrease(next,getValuePath());
        inProcess.remove(next);
        logger.trace("String_Node_Str",next,group.getName());
      }
 catch (      Exception e) {
        logger.warn("String_Node_Str" + next + "String_Node_Str"+ group.getName(),e);
      }
 finally {
        semaphore.release();
      }
      return null;
    }
  }
);
}
Program: 61891
Project: 61891
Buggy source:
private void makeCall(final ObjectNode response) throws ExecutionException, RetryException {
  retryer.call(new Callable<ClientResponse>(){
    @Override public ClientResponse call() throws Exception {
      if (!hasLeadership.get()) {
        logger.debug("String_Node_Str",group.getCallbackUrl(),group.getName(),response);
        return null;
      }
      logger.debug("String_Node_Str",group.getCallbackUrl(),group.getName(),response);
      return client.resource(group.getCallbackUrl()).type(MediaType.APPLICATION_JSON_TYPE).post(ClientResponse.class,response.toString());
    }
  }
);
}

Fixed version (ground truth):
private void makeCall(final ObjectNode response) throws ExecutionException, RetryException {
  retryer.call(new Callable<ClientResponse>(){
    @Override public ClientResponse call() throws Exception {
      if (!hasLeadership.get()) {
        logger.debug("String_Node_Str",group.getCallbackUrl(),group.getName(),response);
        return null;
      }
      logger.debug("String_Node_Str",group.getCallbackUrl(),response);
      return client.resource(group.getCallbackUrl()).type(MediaType.APPLICATION_JSON_TYPE).post(ClientResponse.class,response.toString());
    }
  }
);
}
Program: 61892
Project: 61892
Buggy source:
@Override public ClientResponse call() throws Exception {
  if (!hasLeadership.get()) {
    logger.debug("String_Node_Str",group.getCallbackUrl(),group.getName(),response);
    return null;
  }
  logger.debug("String_Node_Str",group.getCallbackUrl(),group.getName(),response);
  return client.resource(group.getCallbackUrl()).type(MediaType.APPLICATION_JSON_TYPE).post(ClientResponse.class,response.toString());
}

Fixed version (ground truth):
@Override public ClientResponse call() throws Exception {
  if (!hasLeadership.get()) {
    logger.debug("String_Node_Str",group.getCallbackUrl(),group.getName(),response);
    return null;
  }
  logger.debug("String_Node_Str",group.getCallbackUrl(),response);
  return client.resource(group.getCallbackUrl()).type(MediaType.APPLICATION_JSON_TYPE).post(ClientResponse.class,response.toString());
}
Program: 61893
Project: 61893
Buggy source:
private long sendInProcess(long lastCompletedId) throws InterruptedException {
  Set<Long> inProcessSet=inProcess.getSet();
  logger.debug("String_Node_Str",inProcessSet,group.getName());
  for (  Long toSend : inProcessSet) {
    if (toSend < lastCompletedId) {
      send(toSend);
    }
 else {
      inProcess.remove(toSend);
    }
  }
  return lastCompletedId;
}

Fixed version (ground truth):
private long sendInProcess(long lastCompletedId) throws InterruptedException {
  Set<Long> inProcessSet=inProcess.getSet();
  logger.trace("String_Node_Str",inProcessSet,group.getName());
  for (  Long toSend : inProcessSet) {
    if (toSend < lastCompletedId) {
      send(toSend);
    }
 else {
      inProcess.remove(toSend);
    }
  }
  return lastCompletedId;
}
Program: 61894
Project: 61894
Buggy source:
private void send(final long next) throws InterruptedException {
  logger.debug("String_Node_Str",next,group.getName());
  semaphore.acquire();
  executorService.submit(new Callable<Object>(){
    @Override public Object call() throws Exception {
      inProcess.add(next);
      try {
        makeTimedCall(createResponse(next));
        lastCompleted.updateIncrease(next,getValuePath());
        inProcess.remove(next);
        logger.debug("String_Node_Str",next,group.getName());
      }
 catch (      Exception e) {
        logger.warn("String_Node_Str" + next + "String_Node_Str"+ group.getName(),e);
      }
 finally {
        semaphore.release();
      }
      return null;
    }
  }
);
}

Fixed version (ground truth):
private void send(final long next) throws InterruptedException {
  logger.trace("String_Node_Str",next,group.getName());
  semaphore.acquire();
  executorService.submit(new Callable<Object>(){
    @Override public Object call() throws Exception {
      inProcess.add(next);
      try {
        makeTimedCall(createResponse(next));
        lastCompleted.updateIncrease(next,getValuePath());
        inProcess.remove(next);
        logger.trace("String_Node_Str",next,group.getName());
      }
 catch (      Exception e) {
        logger.warn("String_Node_Str" + next + "String_Node_Str"+ group.getName(),e);
      }
 finally {
        semaphore.release();
      }
      return null;
    }
  }
);
}
Program: 61895
Project: 61895
Buggy source:
public Builder withTags(Collection<String> tags){
  this.tags.addAll(tags);
  return this;
}

Fixed version (ground truth):
public Builder withTags(Collection<String> tags){
  this.tags.clear();
  this.tags.addAll(tags);
  return this;
}
Program: 61896
Project: 61896
Buggy source:
@PATCH @Timed @ExceptionMetered @PerChannelTimed(operationName="String_Node_Str",channelNameParameter="String_Node_Str") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) public Response updateMetadata(@PathParam("String_Node_Str") String channelName,String json) throws Exception {
  if (noSuchChannel(channelName)) {
    throw new WebApplicationException(Response.Status.NOT_FOUND);
  }
  ChannelConfiguration oldConfig=channelService.getChannelConfiguration(channelName);
  ChannelConfiguration newConfig=ChannelConfiguration.builder().withChannelConfiguration(oldConfig).withUpdateConfig(ChannelConfiguration.fromJson(json)).build();
  newConfig=channelService.updateChannel(newConfig);
  URI channelUri=linkBuilder.buildChannelUri(newConfig,uriInfo);
  Linked<ChannelConfiguration> linked=linkBuilder.buildChannelLinks(newConfig,channelUri);
  return Response.ok(channelUri).entity(linked).build();
}

Fixed version (ground truth):
@PATCH @Timed @ExceptionMetered @PerChannelTimed(operationName="String_Node_Str",channelNameParameter="String_Node_Str") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) public Response updateMetadata(@PathParam("String_Node_Str") String channelName,String json) throws Exception {
  if (noSuchChannel(channelName)) {
    throw new WebApplicationException(Response.Status.NOT_FOUND);
  }
  ChannelConfiguration oldConfig=channelService.getChannelConfiguration(channelName);
  ChannelConfiguration.Builder builder=ChannelConfiguration.builder().withChannelConfiguration(oldConfig);
  JsonNode rootNode=mapper.readTree(json);
  if (rootNode.has("String_Node_Str")) {
    builder.withDescription(rootNode.get("String_Node_Str").asText());
  }
  if (rootNode.has("String_Node_Str")) {
    builder.withTtlDays(rootNode.get("String_Node_Str").asLong());
  }
 else   if (rootNode.has("String_Node_Str")) {
    builder.withTtlMillis(rootNode.get("String_Node_Str").asLong());
  }
  if (rootNode.has("String_Node_Str")) {
    builder.withContentKiloBytes(rootNode.get("String_Node_Str").asInt());
  }
  if (rootNode.has("String_Node_Str")) {
    builder.withPeakRequestRate(rootNode.get("String_Node_Str").asInt());
  }
  if (rootNode.has("String_Node_Str")) {
    Set<String> tags=new HashSet<>();
    JsonNode tagsNode=rootNode.get("String_Node_Str");
    for (    JsonNode tagNode : tagsNode) {
      tags.add(tagNode.asText());
    }
    builder.withTags(tags);
  }
  ChannelConfiguration newConfig=builder.build();
  newConfig=channelService.updateChannel(newConfig);
  URI channelUri=linkBuilder.buildChannelUri(newConfig,uriInfo);
  Linked<ChannelConfiguration> linked=linkBuilder.buildChannelLinks(newConfig,channelUri);
  return Response.ok(channelUri).entity(linked).build();
}
Program: 61897
Project: 61897
Buggy source:
public Builder withTags(Collection<String> tags){
  this.tags.addAll(tags);
  return this;
}

Fixed version (ground truth):
public Builder withTags(Collection<String> tags){
  this.tags.clear();
  this.tags.addAll(tags);
  return this;
}