Program: 160649
Project: 160649
Buggy source:
public void execute(){
  BimDatabaseSession session=bimServer.getDatabase().createSession(true);
  try {
    createCheckinAction.setDatabaseSession(session);
    session.executeAndCommitAction(createCheckinAction,10,new ProgressHandler(){
      @Override public void progress(      int current,      int max){
        LongCheckinAction.this.progress=current * 100 / max;
      }
    }
);
    session.close();
    BimDatabaseSession extraSession=bimServer.getDatabase().createSession(true);
    try {
      ConcreteRevision concreteRevision=(ConcreteRevision)extraSession.get(StorePackage.eINSTANCE.getConcreteRevision(),createCheckinAction.getCroid(),false,null);
      for (      Revision r : concreteRevision.getRevisions()) {
        Revision latest=null;
        for (        Revision r2 : r.getProject().getRevisions()) {
          if (latest == null || r2.getId() > latest.getId()) {
            latest=r2;
          }
        }
        if (latest != null) {
          latest.getProject().setLastRevision(latest);
          extraSession.store(latest.getProject());
        }
      }
      extraSession.commit();
    }
  finally {
      extraSession.close();
    }
    session=bimServer.getDatabase().createReadOnlySession();
    for (    Revision revision : createCheckinAction.getConcreteRevision(createCheckinAction.getCroid()).getRevisions()) {
      NewRevisionAdded newRevisionAdded=LogFactory.eINSTANCE.createNewRevisionAdded();
      newRevisionAdded.setDate(new Date());
      newRevisionAdded.setExecutor(user);
      newRevisionAdded.setRevision(revision);
      newRevisionAdded.setAccessMethod(createCheckinAction.getAccessMethod());
    }
    startClashDetection(session);
  }
 catch (  OutOfMemoryError e) {
    bimServer.getServerInfoManager().setOutOfMemory();
    return;
  }
catch (  Exception e) {
    LOGGER.error("String_Node_Str",e);
    long croid=createCheckinAction.getCroid();
    try {
      BimDatabaseSession rollBackSession=bimServer.getDatabase().createSession(true);
      try {
        Throwable throwable=e;
        while (throwable.getCause() != null) {
          throwable=throwable.getCause();
        }
        ConcreteRevision concreteRevision=(ConcreteRevision)rollBackSession.get(StorePackage.eINSTANCE.getConcreteRevision(),croid,false,null);
        concreteRevision.setState(CheckinState.ERROR);
        concreteRevision.setLastError(throwable.getMessage());
        for (        Revision revision : concreteRevision.getRevisions()) {
          revision.setState(CheckinState.ERROR);
          revision.setLastError(throwable.getMessage());
        }
        rollBackSession.store(concreteRevision);
        rollBackSession.commit();
      }
  finally {
        rollBackSession.close();
      }
    }
 catch (    BimDeadlockException e1) {
      LOGGER.error("String_Node_Str",e1);
    }
catch (    BimDatabaseException e1) {
      LOGGER.error("String_Node_Str",e1);
    }
  }
 finally {
    session.close();
  }
  done();
}

Fixed version (ground truth):
public void execute(){
  BimDatabaseSession session=bimServer.getDatabase().createSession(true);
  try {
    createCheckinAction.setDatabaseSession(session);
    session.executeAndCommitAction(createCheckinAction,10,new ProgressHandler(){
      @Override public void progress(      int current,      int max){
        LongCheckinAction.this.progress=current * 100 / max;
      }
    }
);
    session.close();
    BimDatabaseSession extraSession=bimServer.getDatabase().createSession(true);
    try {
      ConcreteRevision concreteRevision=(ConcreteRevision)extraSession.get(StorePackage.eINSTANCE.getConcreteRevision(),createCheckinAction.getCroid(),false,null);
      Map<Revision,Project> projects=new HashMap<Revision,Project>();
      for (      Revision r : concreteRevision.getRevisions()) {
        projects.put(r,r.getProject());
      }
      for (      Revision r : concreteRevision.getRevisions()) {
        Revision latest=null;
        for (        Revision r2 : projects.get(r).getRevisions()) {
          if (latest == null || r2.getId() > latest.getId()) {
            latest=r2;
          }
        }
        if (latest != null) {
          Project p=latest.getProject();
          p.setLastRevision(latest);
          extraSession.store(p);
        }
      }
      extraSession.commit();
    }
  finally {
      extraSession.close();
    }
    session=bimServer.getDatabase().createReadOnlySession();
    for (    Revision revision : createCheckinAction.getConcreteRevision(createCheckinAction.getCroid()).getRevisions()) {
      NewRevisionAdded newRevisionAdded=LogFactory.eINSTANCE.createNewRevisionAdded();
      newRevisionAdded.setDate(new Date());
      newRevisionAdded.setExecutor(user);
      newRevisionAdded.setRevision(revision);
      newRevisionAdded.setAccessMethod(createCheckinAction.getAccessMethod());
    }
    startClashDetection(session);
  }
 catch (  OutOfMemoryError e) {
    bimServer.getServerInfoManager().setOutOfMemory();
    return;
  }
catch (  Exception e) {
    LOGGER.error("String_Node_Str",e);
    long croid=createCheckinAction.getCroid();
    try {
      BimDatabaseSession rollBackSession=bimServer.getDatabase().createSession(true);
      try {
        Throwable throwable=e;
        while (throwable.getCause() != null) {
          throwable=throwable.getCause();
        }
        ConcreteRevision concreteRevision=(ConcreteRevision)rollBackSession.get(StorePackage.eINSTANCE.getConcreteRevision(),croid,false,null);
        concreteRevision.setState(CheckinState.ERROR);
        concreteRevision.setLastError(throwable.getMessage());
        for (        Revision revision : concreteRevision.getRevisions()) {
          revision.setState(CheckinState.ERROR);
          revision.setLastError(throwable.getMessage());
        }
        rollBackSession.store(concreteRevision);
        rollBackSession.commit();
      }
  finally {
        rollBackSession.close();
      }
    }
 catch (    BimDeadlockException e1) {
      LOGGER.error("String_Node_Str",e1);
    }
catch (    BimDatabaseException e1) {
      LOGGER.error("String_Node_Str",e1);
    }
  }
 finally {
    session.close();
  }
  done();
}