Program: 113414
Project: 113414
Buggy source:
@Override public int read(UserCredentials userCredentials,byte[] data,int dataOffset,int count,long offset) throws IOException, PosixErrorException, AddressToUUIDNotFoundException {
  fileInfo.waitForPendingAsyncWrites();
  FileCredentials.Builder fcBuilder=FileCredentials.newBuilder();
synchronized (this) {
    if (asyncWritesFailed) {
      throw new PosixErrorException(POSIXErrno.POSIX_ERROR_EIO,"String_Node_Str" + "String_Node_Str");
    }
    fcBuilder.setXcap(xcap.toBuilder());
  }
  FileCredentials fc=fcBuilder.setXlocs(fileInfo.getXLocSet()).build();
  ReusableBuffer buf=ReusableBuffer.wrap(data,dataOffset,count);
  int receivedData=0;
  if (fc.getXlocs().getReplicasCount() == 0) {
    Logging.logMessage(Logging.LEVEL_ERROR,Category.misc,this,"String_Node_Str",fileInfo.getPath());
    throw new PosixErrorException(POSIXErrno.POSIX_ERROR_EIO,"String_Node_Str" + fileInfo.getPath());
  }
  StripingPolicy policy=fc.getXlocs().getReplicas(0).getStripingPolicy();
  StripeTranslator translator=getStripeTranslator(policy.getType());
  Vector<ReadOperation> operations=new Vector<ReadOperation>();
  translator.translateReadRequest(count,offset,policy,operations);
  UUIDIterator tempUuidIteratorForStriping=new UUIDIterator();
  String osdUuid="String_Node_Str";
  for (int j=0; j < operations.size(); j++) {
    readRequest.Builder readRqBuilder=readRequest.newBuilder();
    readRqBuilder.setFileCredentials(fc);
    readRqBuilder.setFileId(fc.getXcap().getFileId());
    readRqBuilder.setObjectNumber(operations.get(j).getObjNumber());
    readRqBuilder.setObjectVersion(0);
    readRqBuilder.setOffset(operations.get(j).getReqOffset());
    readRqBuilder.setLength(operations.get(j).getReqSize());
    UUIDIterator uuidIterator;
    if (readRqBuilder.getFileCredentials().getXlocs().getReplicas(0).getOsdUuidsCount() > 1) {
      osdUuid=Helper.getOSDUUIDFromXlocSet(fc.getXlocs(),0,operations.get(j).getOsdOffset());
      tempUuidIteratorForStriping.clearAndAddUUID(osdUuid);
      uuidIterator=tempUuidIteratorForStriping;
    }
 else {
      uuidIterator=osdUuidIterator;
    }
    buf.position(operations.get(j).getBufferStart());
    ObjectData objectData=RPCCaller.<readRequest,ObjectData>syncCall(SERVICES.OSD,userCredentialsBogus,authBogus,volumeOptions,uuidResolver,uuidIterator,false,readRqBuilder.build(),buf,new CallGenerator<readRequest,ObjectData>(){
      @Override public RPCResponse<ObjectData> executeCall(      InetSocketAddress server,      Auth auth,      UserCredentials userCreds,      readRequest callRequest) throws IOException {
        return osdServiceClient.read(server,auth,userCreds,callRequest);
      }
    }
);
    for (int i=0; i < objectData.getZeroPadding(); i++) {
      buf.put((byte)0);
    }
    receivedData+=buf.position() - operations.get(j).getBufferStart();
  }
  return receivedData;
}

Fixed version (ground truth):
@Override public int read(UserCredentials userCredentials,byte[] data,int dataOffset,int count,long offset) throws IOException, PosixErrorException, AddressToUUIDNotFoundException {
  fileInfo.waitForPendingAsyncWrites();
  FileCredentials.Builder fcBuilder=FileCredentials.newBuilder();
synchronized (this) {
    if (asyncWritesFailed) {
      throw new PosixErrorException(POSIXErrno.POSIX_ERROR_EIO,"String_Node_Str" + "String_Node_Str");
    }
    fcBuilder.setXcap(xcap.toBuilder());
  }
  FileCredentials fc=fcBuilder.setXlocs(fileInfo.getXLocSet()).build();
  ReusableBuffer buf=ReusableBuffer.wrap(data,dataOffset,count);
  int receivedData=0;
  if (fc.getXlocs().getReplicasCount() == 0) {
    Logging.logMessage(Logging.LEVEL_ERROR,Category.misc,this,"String_Node_Str",fileInfo.getPath());
    throw new PosixErrorException(POSIXErrno.POSIX_ERROR_EIO,"String_Node_Str" + fileInfo.getPath());
  }
  StripingPolicy policy=fc.getXlocs().getReplicas(0).getStripingPolicy();
  StripeTranslator translator=getStripeTranslator(policy.getType());
  Vector<ReadOperation> operations=new Vector<ReadOperation>();
  translator.translateReadRequest(count,offset,policy,operations);
  UUIDIterator tempUuidIteratorForStriping=new UUIDIterator();
  for (int j=0; j < operations.size(); j++) {
    readRequest.Builder readRqBuilder=readRequest.newBuilder();
    readRqBuilder.setFileCredentials(fc);
    readRqBuilder.setFileId(fc.getXcap().getFileId());
    readRqBuilder.setObjectNumber(operations.get(j).getObjNumber());
    readRqBuilder.setObjectVersion(0);
    readRqBuilder.setOffset(operations.get(j).getReqOffset());
    readRqBuilder.setLength(operations.get(j).getReqSize());
    UUIDIterator uuidIterator;
    if (readRqBuilder.getFileCredentials().getXlocs().getReplicas(0).getOsdUuidsCount() > 1) {
      tempUuidIteratorForStriping.clear();
      int stripeWidthFirstReplica=fc.getXlocs().getReplicas(0).getStripingPolicy().getWidth();
      for (int replicaIdx=0; replicaIdx < fc.getXlocs().getReplicasCount(); replicaIdx++) {
        if (fc.getXlocs().getReplicas(replicaIdx).getStripingPolicy().getWidth() == stripeWidthFirstReplica) {
          tempUuidIteratorForStriping.addUUID(Helper.getOSDUUIDFromXlocSet(fc.getXlocs(),replicaIdx,operations.get(j).getOsdOffset()));
        }
      }
      uuidIterator=tempUuidIteratorForStriping;
    }
 else {
      uuidIterator=osdUuidIterator;
    }
    buf.position(operations.get(j).getBufferStart());
    ObjectData objectData=RPCCaller.<readRequest,ObjectData>syncCall(SERVICES.OSD,userCredentialsBogus,authBogus,volumeOptions,uuidResolver,uuidIterator,false,readRqBuilder.build(),buf,new CallGenerator<readRequest,ObjectData>(){
      @Override public RPCResponse<ObjectData> executeCall(      InetSocketAddress server,      Auth auth,      UserCredentials userCreds,      readRequest callRequest) throws IOException {
        return osdServiceClient.read(server,auth,userCreds,callRequest);
      }
    }
);
    for (int i=0; i < objectData.getZeroPadding(); i++) {
      buf.put((byte)0);
    }
    receivedData+=buf.position() - operations.get(j).getBufferStart();
  }
  return receivedData;
}