Program: 160558
Project: 160558
Buggy source:
@Override public IfcModelInterface execute() throws UserException, BimserverLockConflictException, BimserverDatabaseException {
  User user=getUserByUoid(getAuthorization().getUoid());
  Set<String> foundGuids=new HashSet<String>();
  IfcModelSet ifcModelSet=new IfcModelSet();
  Project project=null;
  long incrSize=0L;
  SerializerPluginConfiguration serializerPluginConfiguration=getDatabaseSession().get(StorePackage.eINSTANCE.getSerializerPluginConfiguration(),serializerOid,Query.getDefault());
  for (  Long roid : roids) {
    Revision virtualRevision=getRevisionByRoid(roid);
    project=virtualRevision.getProject();
    if (!getAuthorization().hasRightsOnProjectOrSuperProjectsOrSubProjects(user,project)) {
      throw new UserException("String_Node_Str");
    }
    Map<ConcreteRevision,Set<Long>> map=new HashMap<ConcreteRevision,Set<Long>>();
    for (    String guid : guids) {
      if (!foundGuids.contains(guid)) {
        for (        ConcreteRevision concreteRevision : virtualRevision.getConcreteRevisions()) {
          ObjectIdentifier objectIdentifier=getDatabaseSession().getOidOfGuid(guid,concreteRevision.getProject().getId(),concreteRevision.getId());
          if (objectIdentifier != null) {
            foundGuids.add(guid);
            if (!map.containsKey(concreteRevision)) {
              map.put(concreteRevision,new HashSet<Long>());
              incrSize+=concreteRevision.getSize();
            }
            map.get(concreteRevision).add(objectIdentifier.getOid());
          }
        }
      }
    }
    final long totalSize=incrSize;
    final AtomicLong total=new AtomicLong();
    for (    ConcreteRevision concreteRevision : map.keySet()) {
      IfcModel subModel=new IfcModel();
      int highestStopId=findHighestStopRid(project,concreteRevision);
      Query query=new Query(concreteRevision.getProject().getId(),concreteRevision.getId(),objectIDM,deep,highestStopId);
      subModel.addChangeListener(new IfcModelChangeListener(){
        @Override public void objectAdded(){
          total.incrementAndGet();
          progress=Math.round(100L * total.get() / totalSize);
        }
      }
);
      Set<Long> oids=map.get(concreteRevision);
      getDatabaseSession().getMapWithOids(subModel,oids,query);
      subModel.getModelMetaData().setDate(concreteRevision.getDate());
      try {
        checkGeometry(serializerPluginConfiguration,bimServer.getPluginManager(),subModel,project,concreteRevision,virtualRevision);
      }
 catch (      GeometryGeneratingException e) {
        throw new UserException(e);
      }
      ifcModelSet.add(subModel);
    }
  }
  try {
    IfcModelInterface ifcModel=new IfcModel();
    ifcModel=bimServer.getMergerFactory().createMerger(getDatabaseSession(),getAuthorization().getUoid()).merge(project,ifcModelSet,new ModelHelper(ifcModel));
    ifcModel.getModelMetaData().setName("String_Node_Str");
    for (    String guid : guids) {
      if (!foundGuids.contains(guid)) {
        throw new UserException("String_Node_Str" + guid + "String_Node_Str");
      }
    }
    ifcModel.getModelMetaData().setRevisionId(1);
    ifcModel.getModelMetaData().setAuthorizedUser(getUserByUoid(getAuthorization().getUoid()).getName());
    ifcModel.getModelMetaData().setDate(new Date());
    return ifcModel;
  }
 catch (  MergeException e) {
    throw new UserException(e);
  }
}

Fixed version (ground truth):
@Override public IfcModelInterface execute() throws UserException, BimserverLockConflictException, BimserverDatabaseException {
  User user=getUserByUoid(getAuthorization().getUoid());
  Set<String> foundGuids=new HashSet<String>();
  IfcModelSet ifcModelSet=new IfcModelSet();
  Project project=null;
  long incrSize=0L;
  SerializerPluginConfiguration serializerPluginConfiguration=getDatabaseSession().get(StorePackage.eINSTANCE.getSerializerPluginConfiguration(),serializerOid,Query.getDefault());
  for (  Long roid : roids) {
    Revision virtualRevision=getRevisionByRoid(roid);
    project=virtualRevision.getProject();
    if (!getAuthorization().hasRightsOnProjectOrSuperProjectsOrSubProjects(user,project)) {
      throw new UserException("String_Node_Str");
    }
    Map<ConcreteRevision,Set<Long>> map=new HashMap<ConcreteRevision,Set<Long>>();
    for (    String guid : guids) {
      if (!foundGuids.contains(guid)) {
        for (        ConcreteRevision concreteRevision : virtualRevision.getConcreteRevisions()) {
          ObjectIdentifier objectIdentifier=getDatabaseSession().getOidOfGuid(guid,concreteRevision.getProject().getId(),concreteRevision.getId());
          if (objectIdentifier != null) {
            foundGuids.add(guid);
            if (!map.containsKey(concreteRevision)) {
              map.put(concreteRevision,new HashSet<Long>());
              incrSize+=concreteRevision.getSize();
            }
            map.get(concreteRevision).add(objectIdentifier.getOid());
          }
        }
      }
    }
    final long totalSize=incrSize;
    final AtomicLong total=new AtomicLong();
    for (    ConcreteRevision concreteRevision : map.keySet()) {
      IfcModel subModel=new IfcModel();
      int highestStopId=findHighestStopRid(project,concreteRevision);
      Query query=new Query(concreteRevision.getProject().getId(),concreteRevision.getId(),objectIDM,deep,highestStopId);
      subModel.addChangeListener(new IfcModelChangeListener(){
        @Override public void objectAdded(){
          total.incrementAndGet();
          progress=(int)Math.round(100.0 * total.get() / totalSize);
        }
      }
);
      Set<Long> oids=map.get(concreteRevision);
      getDatabaseSession().getMapWithOids(subModel,oids,query);
      subModel.getModelMetaData().setDate(concreteRevision.getDate());
      try {
        checkGeometry(serializerPluginConfiguration,bimServer.getPluginManager(),subModel,project,concreteRevision,virtualRevision);
      }
 catch (      GeometryGeneratingException e) {
        throw new UserException(e);
      }
      ifcModelSet.add(subModel);
    }
  }
  try {
    IfcModelInterface ifcModel=new IfcModel();
    ifcModel=bimServer.getMergerFactory().createMerger(getDatabaseSession(),getAuthorization().getUoid()).merge(project,ifcModelSet,new ModelHelper(ifcModel));
    ifcModel.getModelMetaData().setName("String_Node_Str");
    for (    String guid : guids) {
      if (!foundGuids.contains(guid)) {
        throw new UserException("String_Node_Str" + guid + "String_Node_Str");
      }
    }
    ifcModel.getModelMetaData().setRevisionId(1);
    ifcModel.getModelMetaData().setAuthorizedUser(getUserByUoid(getAuthorization().getUoid()).getName());
    ifcModel.getModelMetaData().setDate(new Date());
    return ifcModel;
  }
 catch (  MergeException e) {
    throw new UserException(e);
  }
}