Program: 113765
Project: 113765
Buggy source:
@Override public void startRequest(DIRRequest rq){
  try {
    final address_mappings_setRequest request=(address_mappings_setRequest)rq.getRequestMessage();
    final AddressMappingSet mappings=request.getAddress_mappings();
    String uuid=null;
    if (mappings.size() == 0) {
      rq.sendException(new InvalidArgumentException("String_Node_Str"));
      return;
    }
    for (    AddressMapping am : mappings) {
      if (uuid == null)       uuid=am.getUuid();
      if (!am.getUuid().equals(uuid)) {
        rq.sendException(new InvalidArgumentException("String_Node_Str"));
        return;
      }
    }
    assert(uuid != null);
    assert(database != null);
    AddressMappingSet dbData=new AddressMappingSet();
    byte[] data=database.directLookup(DIRRequestDispatcher.DB_NAME,DIRRequestDispatcher.INDEX_ID_ADDRMAPS,uuid.getBytes());
    long currentVersion=0;
    if (data != null) {
      ReusableBuffer buf=ReusableBuffer.wrap(data);
      dbData.deserialize(buf);
      if (dbData.size() > 0) {
        currentVersion=dbData.get(0).getVersion();
      }
    }
    if (mappings.get(0).getVersion() != currentVersion) {
      rq.sendException(new ConcurrentModificationException());
      return;
    }
    currentVersion++;
    mappings.get(0).setVersion(currentVersion);
    ONCRPCBufferWriter writer=new ONCRPCBufferWriter(mappings.calculateSize());
    mappings.serialize(writer);
    byte[] newData=writer.getBuffers().get(0).array();
    BabuDBInsertGroup ig=database.createInsertGroup(DIRRequestDispatcher.DB_NAME);
    ig.addInsert(DIRRequestDispatcher.INDEX_ID_ADDRMAPS,uuid.getBytes(),newData);
    database.directInsert(ig);
    address_mappings_setResponse response=new address_mappings_setResponse(currentVersion);
    rq.sendSuccess(response);
  }
 catch (  BabuDBException ex) {
    Logging.logMessage(Logging.LEVEL_ERROR,this,ex);
    rq.sendInternalServerError();
  }
}

Fixed version (ground truth):
@Override public void startRequest(DIRRequest rq){
  try {
    final address_mappings_setRequest request=(address_mappings_setRequest)rq.getRequestMessage();
    final AddressMappingSet mappings=request.getAddress_mappings();
    String uuid=null;
    if (mappings.size() == 0) {
      rq.sendException(new InvalidArgumentException("String_Node_Str"));
      return;
    }
    for (    AddressMapping am : mappings) {
      if (uuid == null)       uuid=am.getUuid();
      if (!am.getUuid().equals(uuid)) {
        rq.sendException(new InvalidArgumentException("String_Node_Str"));
        return;
      }
    }
    assert(uuid != null);
    assert(database != null);
    AddressMappingSet dbData=new AddressMappingSet();
    byte[] data=database.directLookup(DIRRequestDispatcher.DB_NAME,DIRRequestDispatcher.INDEX_ID_ADDRMAPS,uuid.getBytes());
    long currentVersion=0;
    if (data != null) {
      ReusableBuffer buf=ReusableBuffer.wrap(data);
      dbData.deserialize(buf);
      if (dbData.size() > 0) {
        currentVersion=dbData.get(0).getVersion();
      }
    }
    if (mappings.get(0).getVersion() != currentVersion) {
      rq.sendException(new ConcurrentModificationException());
      return;
    }
    currentVersion++;
    mappings.get(0).setVersion(currentVersion);
    ONCRPCBufferWriter writer=new ONCRPCBufferWriter(mappings.calculateSize());
    mappings.serialize(writer);
    byte[] newData=writer.getBuffers().get(0).array();
    writer.freeBuffers();
    BabuDBInsertGroup ig=database.createInsertGroup(DIRRequestDispatcher.DB_NAME);
    ig.addInsert(DIRRequestDispatcher.INDEX_ID_ADDRMAPS,uuid.getBytes(),newData);
    database.directInsert(ig);
    address_mappings_setResponse response=new address_mappings_setResponse(currentVersion);
    rq.sendSuccess(response);
  }
 catch (  BabuDBException ex) {
    Logging.logMessage(Logging.LEVEL_ERROR,this,ex);
    rq.sendInternalServerError(ex);
  }
}