Program: 160407
Project: 160407
Buggy source:
public <T>T executeAndCommitAction(BimDatabaseAction<T> action,int retries,ProgressHandler progressHandler) throws BimserverDatabaseException, UserException, ServerException {
  checkOpen();
  for (int i=0; i < retries; i++) {
    try {
      T result=action.execute();
      if (objectsToCommit.size() > 0 || objectsToDelete.size() > 0) {
        commit(progressHandler);
      }
      return result;
    }
 catch (    BimserverConcurrentModificationDatabaseException e) {
      if (progressHandler != null) {
        progressHandler.retry(i + 1);
      }
      bimTransaction.rollback();
      objectCache.clear();
      objectsToCommit.clear();
      bimTransaction=database.getKeyValueStore().startTransaction();
    }
catch (    BimserverLockConflictException e) {
      LOGGER.info("String_Node_Str");
      bimTransaction.rollback();
      objectCache.clear();
      objectsToCommit.clear();
      bimTransaction=database.getKeyValueStore().startTransaction();
      if (DEVELOPER_DEBUG) {
        LockConflictException lockException=e.getLockException();
        if (lockException instanceof TransactionTimeoutException) {
        }
 else         if (lockException instanceof LockTimeoutException) {
        }
        LOGGER.info("String_Node_Str" + action.getClass().getSimpleName() + "String_Node_Str"+ i+ "String_Node_Str",lockException);
        long[] ownerTxnIds=e.getLockException().getOwnerTxnIds();
        for (        long txnid : ownerTxnIds) {
          DatabaseSession databaseSession=database.getDatabaseSession(txnid);
          if (databaseSession != null) {
            LOGGER.info("String_Node_Str" + databaseSession);
            StackTraceElement[] stackTraceElements=databaseSession.getStackTrace();
            for (            StackTraceElement stackTraceElement : stackTraceElements) {
              LOGGER.info("String_Node_Str" + stackTraceElement);
            }
          }
        }
      }
    }
catch (    UncheckedBimserverLockConflictException e) {
      LOGGER.info("String_Node_Str");
      bimTransaction.rollback();
      objectCache.clear();
      objectsToCommit.clear();
      bimTransaction=database.getKeyValueStore().startTransaction();
    }
catch (    BimserverDatabaseException e) {
      throw e;
    }
catch (    ServiceException e) {
      if (e instanceof UserException) {
        throw ((UserException)e);
      }
 else       if (e instanceof ServerException) {
        throw ((ServerException)e);
      }
 else {
        LOGGER.error("String_Node_Str",e);
      }
    }
    if (i < retries - 1) {
      try {
        Thread.sleep(new Random().nextInt((i + 1) * 1000));
      }
 catch (      InterruptedException e1) {
        LOGGER.error("String_Node_Str",e1);
      }
    }
  }
  throw new BimserverDatabaseException("String_Node_Str" + retries + "String_Node_Str");
}

Fixed version (ground truth):
public <T>T executeAndCommitAction(BimDatabaseAction<T> action,int retries,ProgressHandler progressHandler) throws BimserverDatabaseException, UserException, ServerException {
  checkOpen();
  for (int i=0; i < retries; i++) {
    try {
      T result=action.execute();
      if (objectsToCommit.size() > 0 || objectsToDelete.size() > 0) {
        commit(progressHandler);
      }
      return result;
    }
 catch (    BimserverConcurrentModificationDatabaseException e) {
      if (progressHandler != null) {
        progressHandler.retry(i + 1);
      }
      if (bimTransaction != null) {
        bimTransaction.rollback();
      }
      objectCache.clear();
      objectsToCommit.clear();
      if (bimTransaction != null) {
        bimTransaction=database.getKeyValueStore().startTransaction();
      }
    }
catch (    BimserverLockConflictException e) {
      LOGGER.info("String_Node_Str");
      bimTransaction.rollback();
      objectCache.clear();
      objectsToCommit.clear();
      bimTransaction=database.getKeyValueStore().startTransaction();
      if (DEVELOPER_DEBUG) {
        LockConflictException lockException=e.getLockException();
        if (lockException instanceof TransactionTimeoutException) {
        }
 else         if (lockException instanceof LockTimeoutException) {
        }
        LOGGER.info("String_Node_Str" + action.getClass().getSimpleName() + "String_Node_Str"+ i+ "String_Node_Str",lockException);
        long[] ownerTxnIds=e.getLockException().getOwnerTxnIds();
        for (        long txnid : ownerTxnIds) {
          DatabaseSession databaseSession=database.getDatabaseSession(txnid);
          if (databaseSession != null) {
            LOGGER.info("String_Node_Str" + databaseSession);
            StackTraceElement[] stackTraceElements=databaseSession.getStackTrace();
            for (            StackTraceElement stackTraceElement : stackTraceElements) {
              LOGGER.info("String_Node_Str" + stackTraceElement);
            }
          }
        }
      }
    }
catch (    UncheckedBimserverLockConflictException e) {
      LOGGER.info("String_Node_Str");
      bimTransaction.rollback();
      objectCache.clear();
      objectsToCommit.clear();
      bimTransaction=database.getKeyValueStore().startTransaction();
    }
catch (    BimserverDatabaseException e) {
      throw e;
    }
catch (    ServiceException e) {
      if (e instanceof UserException) {
        throw ((UserException)e);
      }
 else       if (e instanceof ServerException) {
        throw ((ServerException)e);
      }
 else {
        LOGGER.error("String_Node_Str",e);
      }
    }
    if (i < retries - 1) {
      try {
        Thread.sleep(new Random().nextInt((i + 1) * 1000));
      }
 catch (      InterruptedException e1) {
        LOGGER.error("String_Node_Str",e1);
      }
    }
  }
  throw new BimserverDatabaseException("String_Node_Str" + retries + "String_Node_Str");
}