nus-yam/ex-repair huggingface dataset:
Program: 113350
Project: 113350
Buggy source:
/** 
 * Checks, whether a given extend operation (e.g. write, truncate) is executable regarding the registered vouchers. There is no need to block them, because it only checks the limit from the whole beginning. Concurrent access can't effect this.
 * @param clientId
 * @param expireTime
 * @param newFileSize
 * @return
 * @throws VoucherErrorException
 */
public boolean checkMaxVoucherSize(String clientId,long expireTime,long newFileSize) throws VoucherErrorException {
  if (!clientExpireTimeSet.contains(clientId + expireTime)) {
    if (invalidClientExpireTimeSet.contains(clientId + expireTime)) {
      throw new VoucherErrorException(String.format("String_Node_Str",fileId,clientId,expireTime));
    }
 else {
      Logging.logMessage(Logging.LEVEL_WARN,Category.proc,this,"String_Node_Str",fileId,clientId,expireTime);
    }
  }
  if (clientExpireTimeSet.isEmpty() || newFileSize <= voucherSizeMax) {
    return true;
  }
 else {
    Logging.logMessage(Logging.LEVEL_DEBUG,Category.proc,this,"String_Node_Str" + "String_Node_Str",fileId,clientId,newFileSize,voucherSizeMax);
    return false;
  }
}

Fixed version (ground truth):
/** 
 * Checks, whether a given extend operation (e.g. write, truncate) is executable regarding the registered vouchers. There is no need to block them, because it only checks the limit from the whole beginning. Concurrent access can't effect this.
 * @param clientId
 * @param expireTime
 * @param newFileSize
 * @return
 * @throws VoucherErrorException
 */
public boolean checkMaxVoucherSize(String clientId,long expireTime,long newFileSize) throws VoucherErrorException {
  if (!clientExpireTimeSet.contains(expireTime + "String_Node_Str" + clientId)) {
    if (invalidClientExpireTimeSet.contains(expireTime + "String_Node_Str" + clientId)) {
      throw new VoucherErrorException(String.format("String_Node_Str",fileId,clientId,expireTime));
    }
 else {
      Logging.logMessage(Logging.LEVEL_WARN,Category.proc,this,"String_Node_Str",fileId,clientId,expireTime);
    }
  }
  if (clientExpireTimeSet.isEmpty() || newFileSize <= voucherSizeMax) {
    return true;
  }
 else {
    Logging.logMessage(Logging.LEVEL_DEBUG,Category.proc,this,"String_Node_Str" + "String_Node_Str",fileId,clientId,newFileSize,voucherSizeMax);
    return false;
  }
}
Program: 113351
Project: 113351
Buggy source:
/** 
 * @param clientId
 * @param expireTime
 * @param voucherSize
 * @throws VoucherErrorException
 */
public void addVoucher(String clientId,long expireTime,long voucherSize) throws VoucherErrorException {
  Logging.logMessage(Logging.LEVEL_DEBUG,Category.proc,this,"String_Node_Str",fileId,clientId,expireTime,voucherSize);
  if (!invalidClientExpireTimeSet.contains(clientId + expireTime)) {
    if (!clientExpireTimeSet.contains(clientId + expireTime)) {
      clientExpireTimeSet.add(clientId + expireTime);
      voucherSizeMax=(voucherSizeMax < voucherSize) ? voucherSize : voucherSizeMax;
      latestExpireTime=(latestExpireTime < expireTime) ? expireTime : latestExpireTime;
      Logging.logMessage(Logging.LEVEL_DEBUG,Category.proc,this,"String_Node_Str",fileId,clientId,latestExpireTime,voucherSizeMax);
    }
 else {
      Logging.logMessage(Logging.LEVEL_DEBUG,Category.proc,this,"String_Node_Str",fileId,clientId,expireTime,voucherSize);
    }
  }
 else {
    throw new VoucherErrorException(String.format("String_Node_Str",fileId,clientId,expireTime));
  }
}

Fixed version (ground truth):
/** 
 * @param clientId
 * @param expireTime
 * @param voucherSize
 * @throws VoucherErrorException
 */
public void addVoucher(String clientId,long expireTime,long voucherSize) throws VoucherErrorException {
  Logging.logMessage(Logging.LEVEL_DEBUG,Category.proc,this,"String_Node_Str",fileId,clientId,expireTime,voucherSize);
  if (!invalidClientExpireTimeSet.contains(expireTime + "String_Node_Str" + clientId)) {
    if (!clientExpireTimeSet.contains(expireTime + "String_Node_Str" + clientId)) {
      clientExpireTimeSet.add(expireTime + "String_Node_Str" + clientId);
      voucherSizeMax=(voucherSizeMax < voucherSize) ? voucherSize : voucherSizeMax;
      latestExpireTime=(latestExpireTime < expireTime) ? expireTime : latestExpireTime;
      Logging.logMessage(Logging.LEVEL_DEBUG,Category.proc,this,"String_Node_Str",fileId,clientId,latestExpireTime,voucherSizeMax);
    }
 else {
      Logging.logMessage(Logging.LEVEL_DEBUG,Category.proc,this,"String_Node_Str",fileId,clientId,expireTime,voucherSize);
    }
  }
 else {
    throw new VoucherErrorException(String.format("String_Node_Str",fileId,clientId,expireTime));
  }
}
Program: 113352
Project: 113352
Buggy source:
/** 
 * TODO(baerhold): save invalidated Vouchers locally in case of a crash approach
 * @param clientId
 * @param expireTimeSet
 */
public void invalidateVouchers(String clientId,Set<Long> expireTimeSet){
  for (  Long expireTime : expireTimeSet) {
    clientExpireTimeSet.remove(clientId + expireTime);
    invalidClientExpireTimeSet.add(clientId + expireTime);
    latestExpireTime=(latestExpireTime < expireTime) ? expireTime : latestExpireTime;
  }
  return;
}

Fixed version (ground truth):
/** 
 * TODO(baerhold): save invalidated Vouchers locally in case of a crash approach
 * @param clientId
 * @param expireTimeSet
 */
public void invalidateVouchers(String clientId,Set<Long> expireTimeSet){
  long currentTime=TimeSync.getGlobalTime();
  Iterator<String> it=invalidClientExpireTimeSet.iterator();
  while (it.hasNext()) {
    String invalidClientEntry=it.next();
    String expireTime=invalidClientEntry.substring(0,invalidClientEntry.indexOf("String_Node_Str"));
    if (currentTime > Long.valueOf(expireTime)) {
      it.remove();
    }
 else {
      break;
    }
  }
  for (  Long expireTime : expireTimeSet) {
    clientExpireTimeSet.remove(expireTime + "String_Node_Str" + clientId);
    invalidClientExpireTimeSet.add(expireTime + "String_Node_Str" + clientId);
    latestExpireTime=(latestExpireTime < expireTime) ? expireTime : latestExpireTime;
  }
  return;
}
Program: 113353
Project: 113353
Buggy source:
/** 
 * Checks, whether all voucher information regarding this file are invalid by themselves
 * @return
 */
public boolean isObsolete(){
  return (TimeSync.getGlobalTime() / 1000) > latestExpireTime;
}

Fixed version (ground truth):
/** 
 * Checks, whether all voucher information regarding this file are invalid by themselves
 * @return
 */
public boolean isObsolete(){
  return TimeSync.getGlobalTime() > latestExpireTime;
}
Program: 113354
Project: 113354
Buggy source:
/** 
 * @param message
 * @param cause
 * @param enableSuppression
 * @param writableStackTrace
 */
public VoucherErrorException(String message,Throwable cause,boolean enableSuppression,boolean writableStackTrace){
  super(message,cause,enableSuppression,writableStackTrace);
}

Fixed version (ground truth):
/** 
 * @param message
 * @param cause
 */
public VoucherErrorException(String message,Throwable cause){
  super(message,cause);
}
Program: 113355
Project: 113355
Buggy source:
@Override public void startRequest(MRCRequest rq) throws Throwable {
  final xtreemfs_renew_capabilityRequest renewCapabilityRequest=(xtreemfs_renew_capabilityRequest)rq.getRequestArgs();
  Capability cap=new Capability(renewCapabilityRequest.getXcap(),master.getConfig().getCapabilitySecret());
  if (!cap.hasValidSignature())   throw new UserException(POSIXErrno.POSIX_ERROR_EPERM,cap + "String_Node_Str");
  if (cap.hasExpired() && !renewTimedOutCaps)   throw new UserException(POSIXErrno.POSIX_ERROR_EPERM,cap + "String_Node_Str");
  long newExpireMs=TimeSync.getGlobalTime() + master.getConfig().getCapabilityTimeout() * 1000;
  long voucherSize=cap.getVoucherSize();
  if (renewCapabilityRequest.getIncreaseVoucher()) {
    voucherSize=master.getMrcVoucherManager().checkAndRenewVoucher(cap.getFileId(),cap.getClientIdentity(),cap.getExpireMs(),newExpireMs);
  }
  Capability newCap=new Capability(cap.getFileId(),cap.getAccessMode(),master.getConfig().getCapabilityTimeout(),TimeSync.getGlobalTime() / 1000 + master.getConfig().getCapabilityTimeout(),cap.getClientIdentity(),cap.getEpochNo(),cap.isReplicateOnClose(),cap.getSnapConfig(),cap.getSnapTimestamp(),voucherSize,newExpireMs,master.getConfig().getCapabilitySecret());
  rq.setResponse(newCap.getXCap());
  finishRequest(rq);
}

Fixed version (ground truth):
@Override public void startRequest(MRCRequest rq) throws Throwable {
  final xtreemfs_renew_capabilityRequest renewCapabilityRequest=(xtreemfs_renew_capabilityRequest)rq.getRequestArgs();
  Capability cap=new Capability(renewCapabilityRequest.getXcap(),master.getConfig().getCapabilitySecret());
  if (!cap.hasValidSignature())   throw new UserException(POSIXErrno.POSIX_ERROR_EPERM,cap + "String_Node_Str");
  if (cap.hasExpired() && !renewTimedOutCaps)   throw new UserException(POSIXErrno.POSIX_ERROR_EPERM,cap + "String_Node_Str");
  long newExpireMs=TimeSync.getGlobalTime() + master.getConfig().getCapabilityTimeout() * 1000;
  long voucherSize=cap.getVoucherSize();
  if (renewCapabilityRequest.getIncreaseVoucher()) {
    voucherSize=master.getMrcVoucherManager().checkAndRenewVoucher(cap.getFileId(),cap.getClientIdentity(),cap.getExpireMs(),newExpireMs);
  }
 else {
    master.getMrcVoucherManager().addRenewedTimestamp(cap.getFileId(),cap.getClientIdentity(),cap.getExpireMs(),newExpireMs);
  }
  Capability newCap=new Capability(cap.getFileId(),cap.getAccessMode(),master.getConfig().getCapabilityTimeout(),TimeSync.getGlobalTime() / 1000 + master.getConfig().getCapabilityTimeout(),cap.getClientIdentity(),cap.getEpochNo(),cap.isReplicateOnClose(),cap.getSnapConfig(),cap.getSnapTimestamp(),voucherSize,newExpireMs,master.getConfig().getCapabilitySecret());
  rq.setResponse(newCap.getXCap());
  finishRequest(rq);
}
Program: 113356
Project: 113356
Buggy source:
public boolean hasActiveExpireTime(long expireTime){
  return xcapExpireTimeMap.containsKey(expireTime);
}

Fixed version (ground truth):
public boolean hasActiveExpireTime(long expireTime){
  return xcapExpireTimeList.contains(expireTime);
}
Program: 113357
Project: 113357
Buggy source:
public void addVoucher(long expireTime,long voucherSize){
  if (!xcapExpireTimeMap.containsKey(expireTime)) {
    xcapExpireTimeMap.put(expireTime,voucherSize);
  }
 else {
    System.out.println("String_Node_Str");
  }
}

Fixed version (ground truth):
public void addVoucher(long expireTime){
  if (!xcapExpireTimeList.contains(expireTime)) {
    xcapExpireTimeList.add(expireTime);
  }
 else {
    System.out.println("String_Node_Str" + getClass() + "String_Node_Str");
  }
}
Program: 113358
Project: 113358
Buggy source:
public boolean isEmpty(){
  return xcapExpireTimeMap.isEmpty();
}

Fixed version (ground truth):
public boolean isEmpty(){
  return xcapExpireTimeList.isEmpty();
}
Program: 113359
Project: 113359
Buggy source:
public void clearVouchers(Set<Long> expireTimes){
  for (  Long expireTime : expireTimes) {
    if (xcapExpireTimeMap.containsKey(expireTime)) {
      xcapExpireTimeMap.remove(expireTime);
    }
 else {
      System.out.println("String_Node_Str");
    }
  }
}

Fixed version (ground truth):
public void clearVouchers(Set<Long> expireTimes){
  for (  Long expireTime : expireTimes) {
    if (xcapExpireTimeList.contains(expireTime)) {
      xcapExpireTimeList.remove(expireTime);
    }
 else {
      System.out.println("String_Node_Str" + getClass() + "String_Node_Str");
    }
  }
}
Program: 113360
Project: 113360
Buggy source:
@Override public String toString(){
  return "String_Node_Str" + fileID + "String_Node_Str"+ clientID+ "String_Node_Str"+ xcapExpireTimeMap+ "String_Node_Str";
}

Fixed version (ground truth):
@Override public String toString(){
  return "String_Node_Str" + fileID + "String_Node_Str"+ clientID+ "String_Node_Str"+ xcapExpireTimeList+ "String_Node_Str";
}
Program: 113361
Project: 113361
Buggy source:
public long addVoucher(String clientID,long expireTime,long voucherSize){
  ClientVoucherManager clientVoucherManager=openVoucherMap.get(clientID);
  if (clientVoucherManager == null) {
    clientVoucherManager=new ClientVoucherManager(clientID,fileID);
    openVoucherMap.put(clientID,clientVoucherManager);
  }
  blockedSpace+=voucherSize;
  clientVoucherManager.addVoucher(expireTime,fileSize + blockedSpace);
  return fileSize + blockedSpace;
}

Fixed version (ground truth):
public long addVoucher(String clientID,long expireTime,long voucherSize){
  ClientVoucherManager clientVoucherManager=openVoucherMap.get(clientID);
  if (clientVoucherManager == null) {
    clientVoucherManager=new ClientVoucherManager(clientID,fileID);
    openVoucherMap.put(clientID,clientVoucherManager);
  }
  blockedSpace+=voucherSize;
  clientVoucherManager.addVoucher(expireTime);
  return fileSize + blockedSpace;
}
Program: 113367
Project: 113367
Buggy source:
public synchronized long getVoucher(boolean test) throws UserException {
  if (!active) {
    return 0;
  }
  System.out.println(getClass() + "String_Node_Str" + test);
  long currentFreeSpace=getFreeSpace();
  if (currentFreeSpace <= 0) {
    throw new UserException(POSIXErrno.POSIX_ERROR_ENOSPC,"String_Node_Str" + volumeId + "String_Node_Str");
  }
  long voucherSize=volumeVoucherSize;
  if (currentFreeSpace >= volumeVoucherSize) {
    voucherSize=currentFreeSpace;
  }
  if (!test) {
    curBlockedSpace+=voucherSize;
    try {
      AtomicDBUpdate update=volStorageManager.createAtomicDBUpdate(null,null);
      volStorageManager.setVolumeBlockedSpace(curBlockedSpace,update);
      update.execute();
    }
 catch (    DatabaseException e) {
      e.printStackTrace();
    }
  }
  System.out.println(getClass() + "String_Node_Str" + voucherSize+ "String_Node_Str"+ curUsedSpace+ "String_Node_Str"+ curBlockedSpace+ "String_Node_Str"+ volumeQuota+ "String_Node_Str");
  return voucherSize;
}

Fixed version (ground truth):
public synchronized long getVoucher(boolean test) throws UserException {
  if (!active) {
    return 0;
  }
  System.out.println(getClass() + "String_Node_Str" + test);
  long currentFreeSpace=getFreeSpace();
  if (currentFreeSpace <= 0) {
    throw new UserException(POSIXErrno.POSIX_ERROR_ENOSPC,"String_Node_Str" + volumeId + "String_Node_Str");
  }
  long voucherSize=volumeVoucherSize;
  if (volumeVoucherSize > currentFreeSpace) {
    voucherSize=currentFreeSpace;
  }
  if (!test) {
    curBlockedSpace+=voucherSize;
    try {
      AtomicDBUpdate update=volStorageManager.createAtomicDBUpdate(null,null);
      volStorageManager.setVolumeBlockedSpace(curBlockedSpace,update);
      update.execute();
    }
 catch (    DatabaseException e) {
      e.printStackTrace();
    }
  }
  System.out.println(getClass() + "String_Node_Str" + voucherSize+ "String_Node_Str"+ curUsedSpace+ "String_Node_Str"+ curBlockedSpace+ "String_Node_Str"+ volumeQuota+ "String_Node_Str");
  return voucherSize;
}
Program: 113368
Project: 113368
Buggy source:
@Override @Deprecated public int read(UserCredentials userCredentials,byte[] data,int dataOffset,int count,long offset) throws IOException, PosixErrorException, AddressToUUIDNotFoundException {
  throw new RuntimeException("String_Node_Str");
}

Fixed version (ground truth):
public int read(UserCredentials userCredentials,ByteBuffer data,int count,long offset) throws IOException, PosixErrorException, AddressToUUIDNotFoundException {
  if (data.isDirect()) {
    return proxy.readDirect(data,count,offset);
  }
 else   if (data.hasArray()) {
    return proxy.read(data.array(),count,offset);
  }
 else {
    throw new RuntimeException("String_Node_Str");
  }
}
Program: 113369
Project: 113369
Buggy source:
@Override @Deprecated public int write(UserCredentials userCredentials,byte[] data,int dataOffset,int count,long offset) throws IOException, PosixErrorException, AddressToUUIDNotFoundException {
  throw new RuntimeException("String_Node_Str");
}

Fixed version (ground truth):
public int write(UserCredentials userCredentials,ByteBuffer data,int count,long offset) throws IOException, PosixErrorException, AddressToUUIDNotFoundException {
  if (data.isDirect()) {
    return proxy.writeDirect(data,count,offset);
  }
 else   if (data.hasArray()) {
    return proxy.write(data.array(),count,offset);
  }
 else {
    throw new RuntimeException("String_Node_Str");
  }
}
Program: 113370
Project: 113370
Buggy source:
/** 
 * Load the library with the platform independent name. (f.ex. jni-libxtreemfs instead of libjni-xtreemfs.so) <br> If the library does not exists in the java.library.path, but the current class is running within a xtreemfs source directory, the cpp/build directory is searched as well.
 * @param name
 */
public static void loadLibrary(String name){
  try {
    System.loadLibrary(name);
  }
 catch (  UnsatisfiedLinkError error) {
    URL classURL=NativeHelper.class.getResource("String_Node_Str");
    if (classURL == null || !"String_Node_Str".equalsIgnoreCase(classURL.getProtocol())) {
      throw error;
    }
    String path=null;
    String[] components=classURL.getPath().split(File.separator);
    for (int i=0; i < components.length; i++) {
      if (i < components.length - 2 && "String_Node_Str".equals(components[i]) && "String_Node_Str".equals(components[i + 1]) && "String_Node_Str".equals(components[i + 2])) {
        path=String.join("String_Node_Str",Arrays.copyOf(components,i + 1));
      }
    }
    if (path == null) {
      throw error;
    }
    String libName=System.mapLibraryName("String_Node_Str");
    System.load(path + "String_Node_Str" + libName);
  }
}

Fixed version (ground truth):
/** 
 * Load the library with the platform independent name. (f.ex. jni-libxtreemfs instead of libjni-xtreemfs.so) <br> If the library does not exists in the java.library.path, but the current class is running within a xtreemfs source directory, the cpp/build directory is searched as well.
 * @param name
 */
public static void loadLibrary(String name){
  try {
    System.loadLibrary(name);
  }
 catch (  UnsatisfiedLinkError error) {
    URL classURL=NativeHelper.class.getResource("String_Node_Str");
    if (classURL == null || !"String_Node_Str".equalsIgnoreCase(classURL.getProtocol())) {
      throw error;
    }
    String path=classURL.getPath();
    path=path.replace(File.separator,"String_Node_Str");
    int pos=path.lastIndexOf("String_Node_Str");
    if (pos < 0) {
      throw error;
    }
    path=path.substring(0,pos);
    path=path + "String_Node_Str" + System.mapLibraryName("String_Node_Str");
    System.load(path.replace("String_Node_Str",File.separator));
  }
}
Program: 113373
Project: 113373
Buggy source:
private void parsePath(String path){
  if (path.length() == 0) {
    this.path="String_Node_Str";
    this.compIndices=new ArrayList<Integer>(15);
    compIndices.add(-1);
  }
 else {
    this.path=path.charAt(path.length() - 1) == SEPARATOR ? path.substring(0,path.length() - 1) : path;
    this.compIndices=new ArrayList<Integer>(15);
    compIndices.add(-1);
    char[] chars=this.path.toCharArray();
    for (int i=0; i < chars.length; i++)     if (chars[i] == SEPARATOR)     compIndices.add(i);
  }
}

Fixed version (ground truth):
private void parsePath(String path){
  if (path.length() == 0) {
    this.path="String_Node_Str";
    this.compIndices=new ArrayList<Integer>(15);
    compIndices.add(-1);
  }
 else {
    while (path.contains("String_Node_Str")) {
      path=path.replace("String_Node_Str","String_Node_Str");
    }
    this.path=path.charAt(path.length() - 1) == SEPARATOR ? path.substring(0,path.length() - 1) : path;
    this.compIndices=new ArrayList<Integer>(15);
    compIndices.add(-1);
    char[] chars=this.path.toCharArray();
    for (int i=0; i < chars.length; i++)     if (chars[i] == SEPARATOR)     compIndices.add(i);
  }
}
Program: 113374
Project: 113374
Buggy source:
private boolean isHealthy(Service osd){
  int smartTestResult=Integer.valueOf(KeyValuePairs.getValue(osd.getData().getDataList(),"String_Node_Str"));
  return smartTestResult != SmartTestResult.SMART_TEST_RESULT_FAILED_VALUE;
}

Fixed version (ground truth):
private boolean isHealthy(Service osd){
  String smartTestResult=KeyValuePairs.getValue(osd.getData().getDataList(),"String_Node_Str");
  if (smartTestResult == null) {
    return true;
  }
  return Integer.valueOf(smartTestResult) != SmartTestResult.SMART_TEST_RESULT_FAILED_VALUE;
}
Program: 113377
Project: 113377
Buggy source:
/** 
 * Remove the primary replica and provoke an invalid view error by accessing the file with an outdated xLocSet.
 * @param volumeName
 * @param fileName
 * @throws Exception
 */
private void removeReadOutdated(String volumeName,String fileName) throws Exception {
  AdminVolume volume=client.openVolume(volumeName,null,options);
  AdminFileHandle fileHandle=volume.openFile(userCredentials,fileName,Helper.flagsToInt(SYSTEM_V_FCNTL_H_O_CREAT,SYSTEM_V_FCNTL_H_O_RDWR),0777);
  int count=256 * 1024;
  ReusableBuffer data=SetupUtils.generateData(count,(byte)1);
  fileHandle.write(userCredentials,data.createViewBuffer().getData(),count,0);
  fileHandle.close();
  Thread.sleep(5 * 1000);
  fileHandle=volume.openFile(userCredentials,fileName,Helper.flagsToInt(SYSTEM_V_FCNTL_H_O_RDONLY));
  List<Replica> replicas=fileHandle.getReplicasList();
  Replica replica=replicas.get(0);
  int prevReplicaCount=fileHandle.getReplicasList().size();
  assertEquals(1,replica.getOsdUuidsCount());
  AdminVolume controlVolume=client.openVolume(volumeName,null,options);
  controlVolume.removeReplica(userCredentials,fileName,replica.getOsdUuids(0));
  AdminFileHandle controlFile=controlVolume.openFile(userCredentials,fileName,Helper.flagsToInt(SYSTEM_V_FCNTL_H_O_RDONLY));
  assertEquals(controlFile.getReplicasList().size(),prevReplicaCount - 1);
  controlFile.close();
  controlVolume.close();
  readInvalidView(fileHandle);
  fileHandle.close();
  volume.close();
}

Fixed version (ground truth):
/** 
 * Remove the primary replica and provoke an invalid view error by accessing the file with an outdated xLocSet.
 * @param volumeName
 * @param fileName
 * @throws Exception
 */
private void removeReadOutdated(String volumeName,String fileName) throws Exception {
  AdminVolume volume=client.openVolume(volumeName,null,options);
  AdminFileHandle fileHandle=volume.openFile(userCredentials,fileName,Helper.flagsToInt(SYSTEM_V_FCNTL_H_O_CREAT,SYSTEM_V_FCNTL_H_O_RDWR),0777);
  int count=256 * 1024;
  ReusableBuffer data=SetupUtils.generateData(count,(byte)1);
  fileHandle.write(userCredentials,data.createViewBuffer().getData(),count,0);
  fileHandle.close();
  Thread.sleep(5 * 1000);
  fileHandle=volume.openFile(userCredentials,fileName,Helper.flagsToInt(SYSTEM_V_FCNTL_H_O_RDONLY));
  List<Replica> replicas=fileHandle.getReplicasList();
  Replica replica=replicas.get(1);
  int prevReplicaCount=fileHandle.getReplicasList().size();
  assertEquals(1,replica.getOsdUuidsCount());
  AdminVolume controlVolume=client.openVolume(volumeName,null,options);
  controlVolume.removeReplica(userCredentials,fileName,replica.getOsdUuids(0));
  AdminFileHandle controlFile=controlVolume.openFile(userCredentials,fileName,Helper.flagsToInt(SYSTEM_V_FCNTL_H_O_RDONLY));
  assertEquals(controlFile.getReplicasList().size(),prevReplicaCount - 1);
  controlFile.close();
  controlVolume.close();
  readInvalidView(fileHandle);
  fileHandle.close();
  volume.close();
}
Program: 113378
Project: 113378
Buggy source:
private static void readInvalidView(AdminFileHandle file) throws AddressToUUIDNotFoundException, IOException {
  PosixErrorException catched=null;
  try {
    byte[] dataOut=new byte[1];
    file.read(userCredentials,dataOut,1,0);
  }
 catch (  PosixErrorException e) {
    catched=e;
  }
  assertTrue(catched != null);
  assertEquals(catched.getPosixError(),RPC.POSIXErrno.POSIX_ERROR_EAGAIN);
  assertTrue(catched.getMessage().contains("String_Node_Str"));
}

Fixed version (ground truth):
private static void readInvalidView(AdminFileHandle file) throws AddressToUUIDNotFoundException, IOException {
  int prevMaxTries=options.getMaxTries();
  options.setMaxTries(1);
  try {
    byte[] dataOut=new byte[1];
    file.read(userCredentials,dataOut,1,0);
  }
 catch (  InvalidViewException e) {
  }
 finally {
    options.setMaxTries(prevMaxTries);
  }
}
Program: 113379
Project: 113379
Buggy source:
private void doUpdateXLocSetFromFlease(StageRequest m){
  final ASCIIString cellId=(ASCIIString)m.getArgs()[0];
  final int version=(Integer)m.getArgs()[1];
  final String fileId=ReplicaUpdatePolicy.cellToFileId(cellId);
  XLocSetVersionState state;
  try {
    state=layout.getXLocSetVersionState(fileId);
  }
 catch (  IOException e) {
    Logging.logMessage(Logging.LEVEL_ERROR,Category.replication,this,"String_Node_Str",fileId);
    return;
  }
  if (state.getVersion() < version || (state.getVersion() == version && state.getInvalidated())) {
    state=state.toBuilder().setInvalidated(false).setVersion(version).build();
    try {
      layout.setXLocSetVersionState(fileId,state);
      master.getRWReplicationStage().setFleaseView(fileId,cellId,state);
    }
 catch (    IOException e) {
      Logging.logMessage(Logging.LEVEL_ERROR,Category.replication,this,"String_Node_Str",fileId);
      return;
    }
  }
  return;
}

Fixed version (ground truth):
private void doUpdateXLocSetFromFlease(StageRequest m){
  final ASCIIString cellId=(ASCIIString)m.getArgs()[0];
  final int version=(Integer)m.getArgs()[1];
  final String fileId=ReplicaUpdatePolicy.cellToFileId(cellId);
  XLocSetVersionState state;
  try {
    state=layout.getXLocSetVersionState(fileId);
  }
 catch (  IOException e) {
    Logging.logMessage(Logging.LEVEL_ERROR,Category.replication,this,"String_Node_Str",fileId);
    return;
  }
  if (state.getVersion() < version) {
    state=state.toBuilder().setInvalidated(false).setVersion(version).build();
    try {
      layout.setXLocSetVersionState(fileId,state);
      master.getRWReplicationStage().setFleaseView(fileId,cellId,state);
    }
 catch (    IOException e) {
      Logging.logMessage(Logging.LEVEL_ERROR,Category.replication,this,"String_Node_Str",fileId);
      return;
    }
  }
  return;
}
Program: 113380
Project: 113380
Buggy source:
@BeforeClass public static void initializeTest() throws Exception {
  System.out.println("String_Node_Str" + VersionedXLocSetTest.class.getSimpleName());
  FSUtils.delTree(new java.io.File(SetupUtils.TEST_DIR));
  Logging.start(Logging.LEVEL_WARN);
  testEnv=new TestEnvironment(new TestEnvironment.Services[]{TestEnvironment.Services.TIME_SYNC,TestEnvironment.Services.UUID_RESOLVER,TestEnvironment.Services.RPC_CLIENT,TestEnvironment.Services.DIR_SERVICE,TestEnvironment.Services.DIR_CLIENT,TestEnvironment.Services.MRC,TestEnvironment.Services.MRC_CLIENT,TestEnvironment.Services.OSD_CLIENT});
  testEnv.start();
  osds=new OSD[NUM_OSDS];
  configs=SetupUtils.createMultipleOSDConfigs(NUM_OSDS);
  for (int i=0; i < NUM_OSDS; i++) {
    osds[i]=new OSD(configs[i]);
  }
  dirAddress=testEnv.getDIRAddress().getHostName() + "String_Node_Str" + testEnv.getDIRAddress().getPort();
  mrcAddress=testEnv.getMRCAddress().getHostName() + "String_Node_Str" + testEnv.getMRCAddress().getPort();
  defaultStripingPolicy=StripingPolicy.newBuilder().setType(StripingPolicyType.STRIPING_POLICY_RAID0).setStripeSize(128).setWidth(1).build();
  userCredentials=UserCredentials.newBuilder().setUsername("String_Node_Str").addGroups("String_Node_Str").build();
  auth=RPCAuthentication.authNone;
  options=new Options();
  client=ClientFactory.createAdminClient(dirAddress,userCredentials,null,options);
  client.start();
}

Fixed version (ground truth):
@BeforeClass public static void initializeTest() throws Exception {
  System.out.println("String_Node_Str" + VersionedXLocSetTest.class.getSimpleName());
  FSUtils.delTree(new java.io.File(SetupUtils.TEST_DIR));
  Logging.start(Logging.LEVEL_WARN);
  testEnv=new TestEnvironment(new TestEnvironment.Services[]{TestEnvironment.Services.TIME_SYNC,TestEnvironment.Services.UUID_RESOLVER,TestEnvironment.Services.RPC_CLIENT,TestEnvironment.Services.DIR_SERVICE,TestEnvironment.Services.DIR_CLIENT,TestEnvironment.Services.MRC,TestEnvironment.Services.MRC_CLIENT,TestEnvironment.Services.OSD_CLIENT});
  testEnv.start();
  osds=new OSD[NUM_OSDS];
  configs=SetupUtils.createMultipleOSDConfigs(NUM_OSDS);
  for (int i=0; i < NUM_OSDS; i++) {
    osds[i]=new OSD(configs[i]);
  }
  dirAddress=testEnv.getDIRAddress().getHostName() + "String_Node_Str" + testEnv.getDIRAddress().getPort();
  mrcAddress=testEnv.getMRCAddress().getHostName() + "String_Node_Str" + testEnv.getMRCAddress().getPort();
  defaultStripingPolicy=StripingPolicy.newBuilder().setType(StripingPolicyType.STRIPING_POLICY_RAID0).setStripeSize(128).setWidth(1).build();
  userCredentials=UserCredentials.newBuilder().setUsername("String_Node_Str").addGroups("String_Node_Str").build();
  auth=RPCAuthentication.authNone;
  options=new Options();
  options.setMaxTries(2);
  client=ClientFactory.createAdminClient(dirAddress,userCredentials,null,options);
  client.start();
  OFT_CLEAN_INTERVAL_MS=(Long)PA.getValue(osds[0].getDispatcher().getPreprocStage(),"String_Node_Str");
  LEASE_TIMEOUT_MS=configs[0].getFleaseLeaseToMS();
}
Program: 113381
Project: 113381
Buggy source:
private void testInvalidViewOnAdd(String volumeName,String fileName) throws Exception {
  AdminVolume outdatedVolume=client.openVolume(volumeName,null,options);
  AdminFileHandle outdatedFile=outdatedVolume.openFile(userCredentials,fileName,Helper.flagsToInt(SYSTEM_V_FCNTL_H_O_CREAT,SYSTEM_V_FCNTL_H_O_RDWR),0777);
  System.out.println("String_Node_Str");
  ReusableBuffer data=SetupUtils.generateData(256,(byte)1);
  outdatedFile.write(userCredentials,data.createViewBuffer().getData(),256,0);
  outdatedFile.close();
  System.out.println("String_Node_Str");
  outdatedFile=outdatedVolume.openFile(userCredentials,fileName,Helper.flagsToInt(SYSTEM_V_FCNTL_H_O_RDONLY));
  AdminVolume volume=client.openVolume(volumeName,null,options);
  System.out.println("String_Node_Str");
  addReplicas(volume,fileName,1);
  volume.close();
  System.out.println("String_Node_Str");
  PosixErrorException catched=null;
  try {
    byte[] dataOut=new byte[1];
    outdatedFile.read(userCredentials,dataOut,1,0);
  }
 catch (  PosixErrorException e) {
    catched=e;
  }
 finally {
    outdatedFile.close();
    outdatedVolume.close();
  }
  assertTrue(catched != null);
  assertEquals(catched.getPosixError(),RPC.POSIXErrno.POSIX_ERROR_EAGAIN);
  assertTrue(catched.getMessage().contains("String_Node_Str"));
}

Fixed version (ground truth):
private void testInvalidViewOnAdd(String volumeName,String fileName) throws Exception {
  AdminVolume outdatedVolume=client.openVolume(volumeName,null,options);
  AdminFileHandle outdatedFile=outdatedVolume.openFile(userCredentials,fileName,Helper.flagsToInt(SYSTEM_V_FCNTL_H_O_CREAT,SYSTEM_V_FCNTL_H_O_RDWR),0777);
  System.out.println("String_Node_Str");
  ReusableBuffer data=SetupUtils.generateData(256,(byte)1);
  outdatedFile.write(userCredentials,data.createViewBuffer().getData(),256,0);
  outdatedFile.close();
  System.out.println("String_Node_Str");
  outdatedFile=outdatedVolume.openFile(userCredentials,fileName,Helper.flagsToInt(SYSTEM_V_FCNTL_H_O_RDONLY));
  AdminVolume volume=client.openVolume(volumeName,null,options);
  System.out.println("String_Node_Str");
  addReplicas(volume,fileName,1);
  volume.close();
  System.out.println("String_Node_Str");
  readInvalidView(outdatedFile);
  outdatedFile.close();
  outdatedVolume.close();
}
Program: 113382
Project: 113382
Buggy source:
@Ignore @Test public void testRonlyInvalidViewOnAdd() throws Exception {
  String volumeName="String_Node_Str";
  String fileName="String_Node_Str";
  client.createVolume(mrcAddress,auth,userCredentials,volumeName);
  AdminVolume volume=client.openVolume(volumeName,null,options);
  volume.close();
  int repl_flags=ReplicationFlags.setFullReplica(ReplicationFlags.setSequentialStrategy(0));
  volume.setDefaultReplicationPolicy(userCredentials,"String_Node_Str",ReplicaUpdatePolicies.REPL_UPDATE_PC_RONLY,2,repl_flags);
  testInvalidViewOnAdd(volumeName,fileName);
}

Fixed version (ground truth):
@Test public void testRonlyInvalidViewOnAdd() throws Exception {
  String volumeName="String_Node_Str";
  String fileName="String_Node_Str";
  client.createVolume(mrcAddress,auth,userCredentials,volumeName);
  AdminVolume volume=client.openVolume(volumeName,null,options);
  volume.setReplicaSelectionPolicy(userCredentials,Helper.policiesToString(new OSDSelectionPolicyType[]{OSDSelectionPolicyType.OSD_SELECTION_POLICY_SORT_UUID}));
  int repl_flags=ReplicationFlags.setFullReplica(ReplicationFlags.setSequentialStrategy(0));
  volume.setDefaultReplicationPolicy(userCredentials,"String_Node_Str",ReplicaUpdatePolicies.REPL_UPDATE_PC_RONLY,2,repl_flags);
  volume.close();
  testInvalidViewOnAdd(volumeName,fileName);
}
Program: 113383
Project: 113383
Buggy source:
@Ignore @Test public void testWqRqRemoveReadOutdated() throws Exception {
  String volumeName="String_Node_Str";
  String fileName="String_Node_Str";
  client.createVolume(mrcAddress,auth,userCredentials,volumeName);
  AdminVolume volume=client.openVolume(volumeName,null,options);
  volume.setDefaultReplicationPolicy(userCredentials,"String_Node_Str",ReplicaUpdatePolicies.REPL_UPDATE_PC_WQRQ,3,0);
  volume.setOSDSelectionPolicy(userCredentials,Helper.policiesToString(new OSDSelectionPolicyType[]{OSDSelectionPolicyType.OSD_SELECTION_POLICY_FILTER_DEFAULT,OSDSelectionPolicyType.OSD_SELECTION_POLICY_SORT_UUID}));
  volume.setReplicaSelectionPolicy(userCredentials,Helper.policiesToString(new OSDSelectionPolicyType[]{OSDSelectionPolicyType.OSD_SELECTION_POLICY_SORT_UUID}));
  volume.close();
  removeReadOutdated(volumeName,fileName);
}

Fixed version (ground truth):
@Test public void testWqRqRemoveReadOutdated() throws Exception {
  String volumeName="String_Node_Str";
  String fileName="String_Node_Str";
  client.createVolume(mrcAddress,auth,userCredentials,volumeName);
  AdminVolume volume=client.openVolume(volumeName,null,options);
  volume.setDefaultReplicationPolicy(userCredentials,"String_Node_Str",ReplicaUpdatePolicies.REPL_UPDATE_PC_WQRQ,3,0);
  volume.setOSDSelectionPolicy(userCredentials,Helper.policiesToString(new OSDSelectionPolicyType[]{OSDSelectionPolicyType.OSD_SELECTION_POLICY_FILTER_DEFAULT,OSDSelectionPolicyType.OSD_SELECTION_POLICY_SORT_UUID}));
  volume.setReplicaSelectionPolicy(userCredentials,Helper.policiesToString(new OSDSelectionPolicyType[]{OSDSelectionPolicyType.OSD_SELECTION_POLICY_SORT_UUID}));
  volume.close();
  removeReadOutdated(volumeName,fileName);
}
Program: 113385
Project: 113385
Buggy source:
@Ignore @Test public void testWqRqInvalidViewOnAdd() throws Exception {
  String volumeName="String_Node_Str";
  String fileName="String_Node_Str";
  client.createVolume(mrcAddress,auth,userCredentials,volumeName);
  AdminVolume volume=client.openVolume(volumeName,null,options);
  volume.setDefaultReplicationPolicy(userCredentials,"String_Node_Str",ReplicaUpdatePolicies.REPL_UPDATE_PC_WQRQ,2,0);
  volume.close();
  testInvalidViewOnAdd(volumeName,fileName);
}

Fixed version (ground truth):
@Test public void testWqRqInvalidViewOnAdd() throws Exception {
  String volumeName="String_Node_Str";
  String fileName="String_Node_Str";
  client.createVolume(mrcAddress,auth,userCredentials,volumeName);
  AdminVolume volume=client.openVolume(volumeName,null,options);
  volume.setDefaultReplicationPolicy(userCredentials,"String_Node_Str",ReplicaUpdatePolicies.REPL_UPDATE_PC_WQRQ,2,0);
  volume.close();
  testInvalidViewOnAdd(volumeName,fileName);
}
Program: 113387
Project: 113387
Buggy source:
public void waitForShutdown() throws Exception {
  client.waitForShutdown();
  fleaseClient.waitForShutdown();
  fstage.waitForShutdown();
  masterEpochThread.waitForShutdown();
  super.waitForShutdown();
}

Fixed version (ground truth):
@Override public void waitForShutdown() throws Exception {
  client.waitForShutdown();
  fleaseClient.waitForShutdown();
  fstage.waitForShutdown();
  masterEpochThread.waitForShutdown();
  super.waitForShutdown();
}
Program: 113388
Project: 113388
Buggy source:
private void doUpdateXLocSetFromFlease(StageRequest m){
  final ASCIIString cellId=(ASCIIString)m.getArgs()[0];
  final int version=(int)m.getArgs()[1];
  final String fileId=ReplicaUpdatePolicy.cellToFileId(cellId);
  XLocSetVersionState state;
  try {
    state=layout.getXLocSetVersionState(fileId);
  }
 catch (  IOException e) {
    Logging.logMessage(Logging.LEVEL_ERROR,Category.replication,this,"String_Node_Str",fileId);
    return;
  }
  if (state.getVersion() < version || (state.getVersion() == version && state.getInvalidated())) {
    state=state.toBuilder().setInvalidated(false).setVersion(version).build();
    try {
      layout.setXLocSetVersionState(fileId,state);
      master.getRWReplicationStage().setFleaseView(fileId,cellId,state);
    }
 catch (    IOException e) {
      Logging.logMessage(Logging.LEVEL_ERROR,Category.replication,this,"String_Node_Str",fileId);
      return;
    }
  }
  return;
}

Fixed version (ground truth):
private void doUpdateXLocSetFromFlease(StageRequest m){
  final ASCIIString cellId=(ASCIIString)m.getArgs()[0];
  final int version=(Integer)m.getArgs()[1];
  final String fileId=ReplicaUpdatePolicy.cellToFileId(cellId);
  XLocSetVersionState state;
  try {
    state=layout.getXLocSetVersionState(fileId);
  }
 catch (  IOException e) {
    Logging.logMessage(Logging.LEVEL_ERROR,Category.replication,this,"String_Node_Str",fileId);
    return;
  }
  if (state.getVersion() < version || (state.getVersion() == version && state.getInvalidated())) {
    state=state.toBuilder().setInvalidated(false).setVersion(version).build();
    try {
      layout.setXLocSetVersionState(fileId,state);
      master.getRWReplicationStage().setFleaseView(fileId,cellId,state);
    }
 catch (    IOException e) {
      Logging.logMessage(Logging.LEVEL_ERROR,Category.replication,this,"String_Node_Str",fileId);
      return;
    }
  }
  return;
}
Program: 113389
Project: 113389
Buggy source:
private void addReplicas(Volume volume,String fileName,int replicaNumber) throws IOException, InterruptedException {
  List<String> osdUUIDs=volume.getSuitableOSDs(userCredentials,fileName,replicaNumber);
  assert(osdUUIDs.size() >= replicaNumber);
  int currentReplicaNumber=volume.listReplicas(userCredentials,fileName).getReplicasCount();
  int repl_flags;
  try {
    String rpAsJSON=volume.getXAttr(userCredentials,"String_Node_Str","String_Node_Str");
    Map<String,Object> rp=(Map<String,Object>)JSONParser.parseJSON(new JSONString(rpAsJSON));
    repl_flags=(int)((long)rp.get("String_Node_Str"));
  }
 catch (  JSONException e) {
    throw new IOException(e);
  }
  Thread.sleep(16 * 1000);
  for (int i=0; i < replicaNumber; i++) {
    Replica replica=Replica.newBuilder().setStripingPolicy(defaultStripingPolicy).setReplicationFlags(repl_flags).addOsdUuids(osdUUIDs.get(i)).build();
    volume.addReplica(userCredentials,fileName,replica);
    Thread.sleep(16 * 1000);
    System.out.println("String_Node_Str" + osdUUIDs.get(i));
  }
  assertEquals(currentReplicaNumber + replicaNumber,volume.listReplicas(userCredentials,fileName).getReplicasCount());
}

Fixed version (ground truth):
private void addReplicas(Volume volume,String fileName,int replicaNumber) throws IOException, InterruptedException {
  List<String> osdUUIDs=volume.getSuitableOSDs(userCredentials,fileName,replicaNumber);
  assert(osdUUIDs.size() >= replicaNumber);
  int currentReplicaNumber=volume.listReplicas(userCredentials,fileName).getReplicasCount();
  int repl_flags;
  try {
    String rpAsJSON=volume.getXAttr(userCredentials,"String_Node_Str","String_Node_Str");
    Map<String,Object> rp=(Map<String,Object>)JSONParser.parseJSON(new JSONString(rpAsJSON));
    long temp=((Long)rp.get("String_Node_Str"));
    repl_flags=(int)temp;
  }
 catch (  JSONException e) {
    throw new IOException(e);
  }
  Thread.sleep(16 * 1000);
  for (int i=0; i < replicaNumber; i++) {
    Replica replica=Replica.newBuilder().setStripingPolicy(defaultStripingPolicy).setReplicationFlags(repl_flags).addOsdUuids(osdUUIDs.get(i)).build();
    volume.addReplica(userCredentials,fileName,replica);
    Thread.sleep(16 * 1000);
    System.out.println("String_Node_Str" + osdUUIDs.get(i));
  }
  assertEquals(currentReplicaNumber + replicaNumber,volume.listReplicas(userCredentials,fileName).getReplicasCount());
}
Program: 113390
Project: 113390
Buggy source:
/** 
 * Build the   {@link BenchmarkConfig} object.
 * @return the build {@link BenchmarkConfig} object
 * @throws Exception
 */
public BenchmarkConfig build() throws Exception {
  verifyNoCleanup();
  if (null != this.parent)   mergeParent();
  String[] dirAddresses=Controller.getDefaultDir();
  if (null != dirAddresses)   setDirAddresses(dirAddresses);
  if (null == props.getProperty("String_Node_Str"))   setDirAddresses(new String[]{"String_Node_Str"});
  BenchmarkConfig config=new BenchmarkConfig(props,this.options,this.policyAttributes);
  config.setDefaults();
  return config;
}

Fixed version (ground truth):
/** 
 * Build the   {@link BenchmarkConfig} object.
 * @return the build {@link BenchmarkConfig} object
 * @throws Exception
 */
public BenchmarkConfig build() throws Exception {
  verifyNoCleanup();
  if (null != this.parent)   mergeParent();
  if (null == props.getProperty("String_Node_Str")) {
    String[] dirAddresses=Controller.getDefaultDir();
    if (null != dirAddresses)     setDirAddresses(dirAddresses);
 else     setDirAddresses(new String[]{"String_Node_Str"});
  }
  BenchmarkConfig config=new BenchmarkConfig(props,this.options,this.policyAttributes);
  config.setDefaults();
  return config;
}
Program: 113391
Project: 113391
Buggy source:
@Override public FSDataOutputStream create(Path path,FsPermission fp,boolean overwrite,int bufferSize,short replication,long blockSize,Progressable p) throws IOException {
  Volume xtreemfsVolume=getVolumeFromPath(path);
  final String pathString=preparePath(path,xtreemfsVolume);
  int flags=SYSTEM_V_FCNTL.SYSTEM_V_FCNTL_H_O_RDWR.getNumber() | SYSTEM_V_FCNTL.SYSTEM_V_FCNTL_H_O_CREAT.getNumber();
  if (overwrite) {
    flags|=SYSTEM_V_FCNTL.SYSTEM_V_FCNTL_H_O_TRUNC.getNumber();
  }
  if (Logging.isDebug()) {
    Logging.logMessage(Logging.LEVEL_DEBUG,this,"String_Node_Str",pathString,overwrite);
  }
  mkdirs(path.getParent());
  final FileHandle fileHandle=xtreemfsVolume.openFile(userCredentials,pathString,flags,fp.toShort());
  return new FSDataOutputStream(new XtreemFSFileOutputStream(userCredentials,fileHandle,pathString,useWriteBuffer,writeBufferSize),statistics);
}

Fixed version (ground truth):
@Override public FSDataOutputStream create(Path path,FsPermission fp,boolean overwrite,int bufferSize,short replication,long blockSize,Progressable p) throws IOException {
  Volume xtreemfsVolume=getVolumeFromPath(path);
  final String pathString=preparePath(path,xtreemfsVolume);
  int flags=SYSTEM_V_FCNTL.SYSTEM_V_FCNTL_H_O_RDWR.getNumber() | SYSTEM_V_FCNTL.SYSTEM_V_FCNTL_H_O_CREAT.getNumber();
  if (overwrite) {
    flags|=SYSTEM_V_FCNTL.SYSTEM_V_FCNTL_H_O_TRUNC.getNumber();
  }
  if (Logging.isDebug()) {
    Logging.logMessage(Logging.LEVEL_DEBUG,this,"String_Node_Str",pathString,overwrite);
  }
  if (pathString.lastIndexOf("String_Node_Str") != 0) {
    mkdirs(path.getParent());
  }
  final FileHandle fileHandle=xtreemfsVolume.openFile(userCredentials,pathString,flags,fp.toShort());
  return new FSDataOutputStream(new XtreemFSFileOutputStream(userCredentials,fileHandle,pathString,useWriteBuffer,writeBufferSize),statistics);
}
Program: 113392
Project: 113392
Buggy source:
@Override public FSDataOutputStream append(Path path,int i,Progressable p) throws IOException {
  throw new UnsupportedOperationException("String_Node_Str");
}

Fixed version (ground truth):
@Override public FSDataOutputStream append(Path path,int bufferSize,Progressable p) throws IOException {
  throw new UnsupportedOperationException("String_Node_Str");
}
Program: 113393
Project: 113393
Buggy source:
/** 
 * Deletes all created volumes and files and shuts down all clients. This method should be called when all benchmarks are finished. The deletion of the volumes and files is regulated by the noCleanup options in  {@link Config}.
 * @throws Exception
 */
public void teardown() throws Exception {
  deleteVolumesAndFiles();
  clientManager.shutdownClients();
  if (config.isOsdCleanup())   volumeManager.cleanupOSD();
}

Fixed version (ground truth):
/** 
 * Deletes all created volumes and files and shuts down all clients. This method should be called when all benchmarks are finished. The deletion of the volumes and files is regulated by the noCleanup options in  {@link Config}.
 * @throws Exception
 */
public void teardown() throws Exception {
  deleteVolumesAndFiles();
  if (config.isOsdCleanup())   volumeManager.cleanupOSD();
  clientManager.shutdownClients();
}
Program: 113394
Project: 113394
Buggy source:
private void verifySizesAndThreads(long size,int threads,BenchmarkType type){
  if (size % (config.getStripeSizeInBytes() * config.getStripeWidth()) != 0)   throw new IllegalArgumentException("String_Node_Str" + type + "String_Node_Str");
  if ((type == BenchmarkType.RAND_READ) || (type == BenchmarkType.RAND_WRITE)) {
    if (config.getBasefileSizeInBytes() < size)     throw new IllegalArgumentException("String_Node_Str" + type);
  }
  if ((type == BenchmarkType.FILES_WRITE) || (type == BenchmarkType.FILES_READ)) {
    if (size % config.getFilesize() != 0)     throw new IllegalArgumentException("String_Node_Str" + type + "String_Node_Str");
  }
  if (volumeManager.getVolumes().size() < threads)   throw new IllegalArgumentException("String_Node_Str");
}

Fixed version (ground truth):
private void verifySizesAndThreads(long size,int threads,BenchmarkType type){
  if ((type == BenchmarkType.SEQ_READ) || (type == BenchmarkType.SEQ_WRITE)) {
    if (size % (config.getStripeSizeInBytes() * config.getStripeWidth()) != 0)     throw new IllegalArgumentException("String_Node_Str" + type + "String_Node_Str");
  }
  if ((type == BenchmarkType.RAND_READ) || (type == BenchmarkType.RAND_WRITE)) {
    if (config.getBasefileSizeInBytes() < size)     throw new IllegalArgumentException("String_Node_Str" + type);
  }
  if ((type == BenchmarkType.FILES_WRITE) || (type == BenchmarkType.FILES_READ)) {
    if (size % config.getFilesize() != 0)     throw new IllegalArgumentException("String_Node_Str" + type + "String_Node_Str");
  }
  if (volumeManager.getVolumes().size() < threads)   throw new IllegalArgumentException("String_Node_Str");
}
Program: 113395
Project: 113395
Buggy source:
void openVolumes(String... volumeName) throws IOException {
  this.volumes=new LinkedList<Volume>();
  for (  String each : volumeName) {
    volumes.add(createAndOpenVolume(each));
  }
}

Fixed version (ground truth):
void openVolumes(String... volumeName) throws IOException {
  this.volumes=new LinkedList<Volume>();
  for (  String each : volumeName) {
    volumes.add(createAndOpenVolume(each));
  }
  verifyVolumeSizes();
}