Program: 160395
Project: 160395
Buggy source:
@Override public IfcModelInterface execute() throws UserException, BimserverLockConflictException, BimserverDatabaseException {
  User user=getUserByUoid(getAuthorization().getUoid());
  Project project=null;
  String projectName="String_Node_Str";
  IfcModelSet ifcModelSet=new IfcModelSet();
  long incrSize=0;
  for (  long roid : roids) {
    Revision revision=getRevisionByRoid(roid);
    for (    ConcreteRevision subRevision : revision.getConcreteRevisions()) {
      incrSize+=subRevision.getSize();
    }
  }
  final long totalSize=incrSize;
  final AtomicLong total=new AtomicLong();
  PluginConfiguration serializerPluginConfiguration=getDatabaseSession().get(StorePackage.eINSTANCE.getPluginConfiguration(),serializerOid,OldQuery.getDefault());
  PackageMetaData lastPackageMetaData=null;
  IfcHeader ifcHeader=null;
  Map<Integer,Long> pidRoidMap=new HashMap<>();
  for (  long roid : roids) {
    Revision revision=getRevisionByRoid(roid);
    project=revision.getProject();
    pidRoidMap.put(project.getId(),roid);
    if (getAuthorization().hasRightsOnProjectOrSuperProjectsOrSubProjects(user,project)) {
      for (      ConcreteRevision concreteRevision : revision.getConcreteRevisions()) {
        ifcHeader=concreteRevision.getIfcHeader();
        PackageMetaData packageMetaData=getBimServer().getMetaDataManager().getPackageMetaData(concreteRevision.getProject().getSchema());
        lastPackageMetaData=packageMetaData;
        IfcModel subModel=new ServerIfcModel(packageMetaData,pidRoidMap,getDatabaseSession());
        int highestStopId=findHighestStopRid(project,concreteRevision);
        OldQuery query=new OldQuery(packageMetaData,concreteRevision.getProject().getId(),concreteRevision.getId(),revision.getOid(),objectIDM,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));
            }
          }
        }
);
        query.updateOidCounters(concreteRevision,getDatabaseSession());
        getDatabaseSession().getMap(subModel,query);
        projectName+=concreteRevision.getProject().getName() + "String_Node_Str";
        subModel.getModelMetaData().setDate(concreteRevision.getDate());
        try {
          checkGeometry(serializerPluginConfiguration,getBimServer().getPluginManager(),subModel,project,concreteRevision,revision);
        }
 catch (        GeometryGeneratingException e) {
          throw new UserException(e);
        }
        ifcModelSet.add(subModel);
      }
    }
 else {
      throw new UserException("String_Node_Str" + project.getOid());
    }
  }
  IfcModelInterface ifcModel=new ServerIfcModel(lastPackageMetaData,pidRoidMap,getDatabaseSession());
  try {
    ifcModel=getBimServer().getMergerFactory().createMerger(getDatabaseSession(),getAuthorization().getUoid()).merge(project,ifcModelSet,new ModelHelper(getBimServer().getMetaDataManager(),ifcModel));
  }
 catch (  MergeException e) {
    throw new UserException(e);
  }
  if (ifcHeader != null) {
    ifcHeader.load();
    ifcModel.getModelMetaData().setIfcHeader(ifcHeader);
  }
  if (projectName.endsWith("String_Node_Str")) {
    projectName=projectName.substring(0,projectName.length() - 1);
  }
  ifcModel.getModelMetaData().setName(projectName);
  return ifcModel;
}

Fixed version (ground truth):
@Override public IfcModelInterface execute() throws UserException, BimserverLockConflictException, BimserverDatabaseException {
  User user=getUserByUoid(getAuthorization().getUoid());
  Project project=null;
  String projectName="String_Node_Str";
  IfcModelSet ifcModelSet=new IfcModelSet();
  long incrSize=0;
  for (  long roid : roids) {
    Revision revision=getRevisionByRoid(roid);
    for (    ConcreteRevision subRevision : revision.getConcreteRevisions()) {
      incrSize+=subRevision.getSize();
    }
  }
  final long totalSize=incrSize;
  final AtomicLong total=new AtomicLong();
  PluginConfiguration serializerPluginConfiguration=getDatabaseSession().get(StorePackage.eINSTANCE.getPluginConfiguration(),serializerOid,OldQuery.getDefault());
  PackageMetaData lastPackageMetaData=null;
  IfcHeader ifcHeader=null;
  Map<Integer,Long> pidRoidMap=new HashMap<>();
  for (  long roid : roids) {
    Revision revision=getRevisionByRoid(roid);
    project=revision.getProject();
    pidRoidMap.put(project.getId(),roid);
    if (getAuthorization().hasRightsOnProjectOrSuperProjectsOrSubProjects(user,project)) {
      for (      ConcreteRevision concreteRevision : revision.getConcreteRevisions()) {
        ifcHeader=concreteRevision.getIfcHeader();
        PackageMetaData packageMetaData=getBimServer().getMetaDataManager().getPackageMetaData(concreteRevision.getProject().getSchema());
        lastPackageMetaData=packageMetaData;
        IfcModel subModel=new ServerIfcModel(packageMetaData,pidRoidMap,getDatabaseSession());
        int highestStopId=findHighestStopRid(project,concreteRevision);
        OldQuery query=new OldQuery(packageMetaData,concreteRevision.getProject().getId(),concreteRevision.getId(),revision.getOid(),objectIDM,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));
            }
          }
        }
);
        query.updateOidCounters(concreteRevision,getDatabaseSession());
        getDatabaseSession().getMap(subModel,query);
        projectName+=concreteRevision.getProject().getName() + "String_Node_Str";
        subModel.getModelMetaData().setDate(concreteRevision.getDate());
        try {
          checkGeometry(serializerPluginConfiguration,getBimServer().getPluginManager(),subModel,project,concreteRevision,revision);
        }
 catch (        GeometryGeneratingException e) {
          throw new UserException(e);
        }
        ifcModelSet.add(subModel);
      }
    }
 else {
      throw new UserException("String_Node_Str" + project.getOid());
    }
  }
  IfcModelInterface ifcModel=new ServerIfcModel(lastPackageMetaData,pidRoidMap,getDatabaseSession());
  if (ifcModelSet.size() == 1) {
    ifcModel=ifcModelSet.iterator().next();
  }
 else {
    try {
      ifcModel=getBimServer().getMergerFactory().createMerger(getDatabaseSession(),getAuthorization().getUoid()).merge(project,ifcModelSet,new ModelHelper(getBimServer().getMetaDataManager(),ifcModel));
    }
 catch (    MergeException e) {
      throw new UserException(e);
    }
  }
  if (ifcHeader != null) {
    ifcHeader.load();
    ifcModel.getModelMetaData().setIfcHeader(ifcHeader);
  }
  if (projectName.endsWith("String_Node_Str")) {
    projectName=projectName.substring(0,projectName.length() - 1);
  }
  ifcModel.getModelMetaData().setName(projectName);
  return ifcModel;
}