Program: 113751
Project: 113751
Buggy source:
@Override public void startRequest(DIRRequest rq){
  try {
    final service_registerRequest request=(service_registerRequest)rq.getRequestMessage();
    final ServiceRegistry reg=request.getService();
    byte[] data=database.directLookup(DIRRequestDispatcher.DB_NAME,DIRRequestDispatcher.INDEX_ID_SERVREG,reg.getUuid().getBytes());
    long currentVersion=0;
    if (data != null) {
      ServiceRegistry dbData=new ServiceRegistry();
      ReusableBuffer buf=ReusableBuffer.wrap(data);
      dbData.deserialize(buf);
      currentVersion=dbData.getVersion();
    }
    if (reg.getVersion() != currentVersion) {
      rq.sendException(new ConcurrentModificationException());
      return;
    }
    currentVersion++;
    reg.setVersion(currentVersion);
    reg.getData().add(new KeyValuePair("String_Node_Str",Long.toString(System.currentTimeMillis() / 1000l)));
    final int dataSize=reg.calculateSize();
    ONCRPCBufferWriter writer=new ONCRPCBufferWriter(dataSize);
    reg.serialize(writer);
    writer.flip();
    assert(writer.getBuffers().size() == 1);
    byte[] newData=writer.getBuffers().get(0).array();
    writer.freeBuffers();
    BabuDBInsertGroup ig=database.createInsertGroup(DIRRequestDispatcher.DB_NAME);
    ig.addInsert(DIRRequestDispatcher.INDEX_ID_SERVREG,reg.getUuid().getBytes(),newData);
    database.directInsert(ig);
    service_registerResponse response=new service_registerResponse(currentVersion);
    rq.sendSuccess(response);
  }
 catch (  BabuDBException ex) {
    Logging.logMessage(Logging.LEVEL_ERROR,this,ex);
    rq.sendInternalServerError(ex);
  }
catch (  Throwable th) {
    Logging.logMessage(Logging.LEVEL_ERROR,this,th);
    rq.sendInternalServerError(th);
  }
}

Fixed version (ground truth):
@Override public void startRequest(DIRRequest rq){
  try {
    final service_registerRequest request=(service_registerRequest)rq.getRequestMessage();
    final ServiceRegistry reg=request.getService();
    byte[] data=database.directLookup(DIRRequestDispatcher.DB_NAME,DIRRequestDispatcher.INDEX_ID_SERVREG,reg.getUuid().getBytes());
    long currentVersion=0;
    if (data != null) {
      ServiceRegistry dbData=new ServiceRegistry();
      ReusableBuffer buf=ReusableBuffer.wrap(data);
      dbData.deserialize(buf);
      currentVersion=dbData.getVersion();
    }
    if (reg.getVersion() != currentVersion) {
      rq.sendException(new ConcurrentModificationException());
      return;
    }
    currentVersion++;
    reg.setVersion(currentVersion);
    reg.setLast_updated(System.currentTimeMillis() / 1000l);
    final int dataSize=reg.calculateSize();
    ONCRPCBufferWriter writer=new ONCRPCBufferWriter(dataSize);
    reg.serialize(writer);
    writer.flip();
    assert(writer.getBuffers().size() == 1);
    byte[] newData=writer.getBuffers().get(0).array();
    writer.freeBuffers();
    BabuDBInsertGroup ig=database.createInsertGroup(DIRRequestDispatcher.DB_NAME);
    ig.addInsert(DIRRequestDispatcher.INDEX_ID_SERVREG,reg.getUuid().getBytes(),newData);
    database.directInsert(ig);
    service_registerResponse response=new service_registerResponse(currentVersion);
    rq.sendSuccess(response);
  }
 catch (  BabuDBException ex) {
    Logging.logMessage(Logging.LEVEL_ERROR,this,ex);
    rq.sendInternalServerError(ex);
  }
catch (  Throwable th) {
    Logging.logMessage(Logging.LEVEL_ERROR,this,th);
    rq.sendInternalServerError(th);
  }
}