Program: 160587
Project: 160587
Buggy source:
private IfcModel realCheckout(Project project,Revision revision,DatabaseSession databaseSession,User user) throws BimserverLockConflictException, BimserverDatabaseException, UserException {
  SerializerPluginConfiguration serializerPluginConfiguration=getDatabaseSession().get(StorePackage.eINSTANCE.getSerializerPluginConfiguration(),serializerOid,Query.getDefault());
  final long totalSize=revision.getSize();
  final AtomicLong total=new AtomicLong();
  IfcModelSet ifcModelSet=new IfcModelSet();
  for (  ConcreteRevision subRevision : revision.getConcreteRevisions()) {
    IfcModel subModel=new IfcModel();
    int highestStopId=findHighestStopRid(project,subRevision);
    Query query=new Query(subRevision.getProject().getId(),subRevision.getId(),null,Deep.YES,highestStopId);
    subModel.addChangeListener(new IfcModelChangeListener(){
      @Override public void objectAdded(){
        total.incrementAndGet();
        if (totalSize == 0) {
          setProgress("String_Node_Str",0);
        }
 else {
          setProgress("String_Node_Str",Math.round(100L * total.get() / totalSize));
        }
      }
    }
);
    getDatabaseSession().getMap(subModel,query);
    try {
      checkGeometry(serializerPluginConfiguration,bimServer.getPluginManager(),subModel,project,subRevision,revision);
    }
 catch (    GeometryGeneratingException e) {
      throw new UserException(e);
    }
    subModel.getModelMetaData().setDate(subRevision.getDate());
    ifcModelSet.add(subModel);
  }
  IfcModelInterface ifcModel=new IfcModel();
  if (ifcModelSet.size() > 1) {
    try {
      ifcModel=bimServer.getMergerFactory().createMerger(getDatabaseSession(),getAuthorization().getUoid()).merge(revision.getProject(),ifcModelSet,new ModelHelper(ifcModel));
    }
 catch (    MergeException e) {
      throw new UserException(e);
    }
  }
 else {
    ifcModel=ifcModelSet.iterator().next();
  }
  ifcModel.getModelMetaData().setName(project.getName() + "String_Node_Str" + revision.getId());
  ifcModel.getModelMetaData().setRevisionId(project.getRevisions().indexOf(revision) + 1);
  ifcModel.getModelMetaData().setAuthorizedUser(user.getName());
  ifcModel.getModelMetaData().setDate(new Date());
  return (IfcModel)ifcModel;
}

Fixed version (ground truth):
private IfcModel realCheckout(Project project,Revision revision,DatabaseSession databaseSession,User user) throws BimserverLockConflictException, BimserverDatabaseException, UserException {
  SerializerPluginConfiguration serializerPluginConfiguration=getDatabaseSession().get(StorePackage.eINSTANCE.getSerializerPluginConfiguration(),serializerOid,Query.getDefault());
  final long totalSize=revision.getSize();
  final AtomicLong total=new AtomicLong();
  IfcModelSet ifcModelSet=new IfcModelSet();
  for (  ConcreteRevision subRevision : revision.getConcreteRevisions()) {
    IfcModel subModel=new IfcModel();
    int highestStopId=findHighestStopRid(project,subRevision);
    Query query=new Query(subRevision.getProject().getId(),subRevision.getId(),null,Deep.YES,highestStopId);
    subModel.addChangeListener(new IfcModelChangeListener(){
      @Override public void objectAdded(){
        total.incrementAndGet();
        if (totalSize == 0) {
          setProgress("String_Node_Str",0);
        }
 else {
          setProgress("String_Node_Str",(int)Math.round(100.0 * total.get() / totalSize));
        }
      }
    }
);
    getDatabaseSession().getMap(subModel,query);
    try {
      checkGeometry(serializerPluginConfiguration,bimServer.getPluginManager(),subModel,project,subRevision,revision);
    }
 catch (    GeometryGeneratingException e) {
      throw new UserException(e);
    }
    subModel.getModelMetaData().setDate(subRevision.getDate());
    ifcModelSet.add(subModel);
  }
  IfcModelInterface ifcModel=new IfcModel();
  if (ifcModelSet.size() > 1) {
    try {
      ifcModel=bimServer.getMergerFactory().createMerger(getDatabaseSession(),getAuthorization().getUoid()).merge(revision.getProject(),ifcModelSet,new ModelHelper(ifcModel));
    }
 catch (    MergeException e) {
      throw new UserException(e);
    }
  }
 else {
    ifcModel=ifcModelSet.iterator().next();
  }
  ifcModel.getModelMetaData().setName(project.getName() + "String_Node_Str" + revision.getId());
  ifcModel.getModelMetaData().setRevisionId(project.getRevisions().indexOf(revision) + 1);
  ifcModel.getModelMetaData().setAuthorizedUser(user.getName());
  ifcModel.getModelMetaData().setDate(new Date());
  return (IfcModel)ifcModel;
}