Program: 160345
Project: 160345
Buggy source:
@SuppressWarnings("String_Node_Str") @Override public IfcModelInterface execute() throws UserException, BimserverLockConflictException, BimserverDatabaseException {
  List<String> projectNames=new ArrayList<>();
  setProgress("String_Node_Str",-1);
  for (  long roid : roids) {
    Revision revision=getDatabaseSession().get(StorePackage.eINSTANCE.getRevision(),roid,OldQuery.getDefault());
    projectNames.add(revision.getProject().getName() + "String_Node_Str" + revision.getId());
  }
  String name=Joiner.on("String_Node_Str").join(projectNames);
  PackageMetaData lastPackageMetaData=null;
  Project lastProject=null;
  IfcModelSet ifcModelSet=new IfcModelSet();
  Map<Integer,Long> pidRoidMap=new HashMap<>();
  for (  long roid : roids) {
    Revision revision=getDatabaseSession().get(StorePackage.eINSTANCE.getRevision(),roid,OldQuery.getDefault());
    lastProject=revision.getProject();
    PackageMetaData packageMetaData=getBimServer().getMetaDataManager().getPackageMetaData(revision.getProject().getSchema());
    lastPackageMetaData=packageMetaData;
    JsonQueryObjectModelConverter converter=new JsonQueryObjectModelConverter(packageMetaData);
    ObjectNode queryObject;
    try {
      queryObject=new ObjectMapper().readValue(json,ObjectNode.class);
      Query query=converter.parseJson("String_Node_Str",(ObjectNode)queryObject);
      pidRoidMap.put(revision.getProject().getId(),roid);
      IfcModelInterface ifcModel=new ServerIfcModel(packageMetaData,pidRoidMap,getDatabaseSession());
      ifcModelSet.add(ifcModel);
      QueryObjectProvider queryObjectProvider=new QueryObjectProvider(getDatabaseSession(),getBimServer(),query,Collections.singleton(roid),packageMetaData);
      HashMapVirtualObject next=queryObjectProvider.next();
      while (next != null) {
        IdEObject newObject=packageMetaData.create(next.eClass());
        IdEObjectImpl idEObjectImpl=(IdEObjectImpl)newObject;
        idEObjectImpl.setPid(revision.getProject().getId());
        idEObjectImpl.setOid(next.getOid());
        for (        EAttribute eAttribute : newObject.eClass().getEAllAttributes()) {
          newObject.eSet(eAttribute,next.eGet(eAttribute));
        }
        ifcModel.add(next.getOid(),newObject);
        next=queryObjectProvider.next();
      }
      queryObjectProvider=new QueryObjectProvider(getDatabaseSession(),getBimServer(),query,Collections.singleton(roid),packageMetaData);
      next=queryObjectProvider.next();
      while (next != null) {
        IdEObject idEObject=ifcModel.get(next.getOid());
        if (idEObject.eClass() != next.eClass()) {
          throw new RuntimeException("String_Node_Str");
        }
        for (        EReference eReference : idEObject.eClass().getEAllReferences()) {
          if (eReference.isMany()) {
            List<Long> refOids=(List<Long>)next.eGet(eReference);
            List<IdEObject> list=(List<IdEObject>)idEObject.eGet(eReference);
            if (refOids != null) {
              for (              Long refOid : refOids) {
                IdEObject ref=ifcModel.get(refOid);
                if (ref != null) {
                  list.add(ref);
                }
              }
            }
          }
 else {
            Object r=next.eGet(eReference);
            if (r instanceof Long) {
              long refOid=(Long)r;
              idEObject.eSet(eReference,ifcModel.get(refOid));
            }
 else             if (r instanceof HashMapWrappedVirtualObject) {
              HashMapWrappedVirtualObject hashMapWrappedVirtualObject=(HashMapWrappedVirtualObject)r;
              IdEObject embeddedObject=ifcModel.create(hashMapWrappedVirtualObject.eClass());
              idEObject.eSet(eReference,embeddedObject);
              for (              EAttribute eAttribute : hashMapWrappedVirtualObject.eClass().getEAllAttributes()) {
                embeddedObject.eSet(eAttribute,hashMapWrappedVirtualObject.eGet(eAttribute));
              }
            }
          }
        }
        next=queryObjectProvider.next();
      }
      ifcModel.getModelMetaData().setName(name);
      ifcModel.getModelMetaData().setRevisionId(1);
      if (getAuthorization().getUoid() != -1) {
        ifcModel.getModelMetaData().setAuthorizedUser(getUserByUoid(getAuthorization().getUoid()).getName());
      }
      ifcModel.getModelMetaData().setDate(new Date());
    }
 catch (    IOException e1) {
      e1.printStackTrace();
    }
catch (    IfcModelInterfaceException e) {
      e.printStackTrace();
    }
catch (    QueryException e) {
      e.printStackTrace();
    }
  }
  IfcModelInterface ifcModel=new ServerIfcModel(lastPackageMetaData,pidRoidMap,0,getDatabaseSession());
  if (ifcModelSet.size() > 1) {
    setProgress("String_Node_Str",-1);
    try {
      ifcModel=getBimServer().getMergerFactory().createMerger(getDatabaseSession(),getAuthorization().getUoid()).merge(lastProject,ifcModelSet,new ModelHelper(getBimServer().getMetaDataManager(),ifcModel));
    }
 catch (    MergeException e) {
      throw new UserException(e);
    }
  }
 else {
    ifcModel=ifcModelSet.iterator().next();
  }
  ifcModel.getModelMetaData().setName(name);
  if (getAuthorization().getUoid() != -1) {
    ifcModel.getModelMetaData().setAuthorizedUser(getUserByUoid(getAuthorization().getUoid()).getName());
  }
  ifcModel.getModelMetaData().setDate(new Date());
  return ifcModel;
}

Fixed version (ground truth):
@SuppressWarnings({"String_Node_Str","String_Node_Str"}) @Override public IfcModelInterface execute() throws UserException, BimserverLockConflictException, BimserverDatabaseException {
  List<String> projectNames=new ArrayList<>();
  setProgress("String_Node_Str",-1);
  for (  long roid : roids) {
    Revision revision=getDatabaseSession().get(StorePackage.eINSTANCE.getRevision(),roid,OldQuery.getDefault());
    projectNames.add(revision.getProject().getName() + "String_Node_Str" + revision.getId());
  }
  String name=Joiner.on("String_Node_Str").join(projectNames);
  PackageMetaData lastPackageMetaData=null;
  Project lastProject=null;
  IfcModelSet ifcModelSet=new IfcModelSet();
  Map<Integer,Long> pidRoidMap=new HashMap<>();
  for (  long roid : roids) {
    Revision revision=getDatabaseSession().get(StorePackage.eINSTANCE.getRevision(),roid,OldQuery.getDefault());
    lastProject=revision.getProject();
    PackageMetaData packageMetaData=getBimServer().getMetaDataManager().getPackageMetaData(revision.getProject().getSchema());
    lastPackageMetaData=packageMetaData;
    JsonQueryObjectModelConverter converter=new JsonQueryObjectModelConverter(packageMetaData);
    ObjectNode queryObject;
    try {
      queryObject=new ObjectMapper().readValue(json,ObjectNode.class);
      Query query=converter.parseJson("String_Node_Str",(ObjectNode)queryObject);
      pidRoidMap.put(revision.getProject().getId(),roid);
      IfcModelInterface ifcModel=new ServerIfcModel(packageMetaData,pidRoidMap,getDatabaseSession());
      ifcModelSet.add(ifcModel);
      QueryObjectProvider queryObjectProvider=new QueryObjectProvider(getDatabaseSession(),getBimServer(),query,Collections.singleton(roid),packageMetaData);
      HashMapVirtualObject next=queryObjectProvider.next();
      while (next != null) {
        IdEObject newObject=packageMetaData.create(next.eClass());
        IdEObjectImpl idEObjectImpl=(IdEObjectImpl)newObject;
        idEObjectImpl.setPid(revision.getProject().getId());
        idEObjectImpl.setOid(next.getOid());
        for (        EAttribute eAttribute : newObject.eClass().getEAllAttributes()) {
          Object value=next.eGet(eAttribute);
          if (eAttribute.isMany()) {
            List<?> list=(List<?>)value;
            if (list != null) {
              AbstractEList targetList=(AbstractEList)newObject.eGet(eAttribute);
              for (              Object item : list) {
                targetList.addUnique(item);
              }
            }
          }
 else {
            if (value != null || eAttribute.isUnsettable()) {
              newObject.eSet(eAttribute,value);
            }
          }
        }
        ifcModel.add(next.getOid(),newObject);
        next=queryObjectProvider.next();
      }
      queryObjectProvider=new QueryObjectProvider(getDatabaseSession(),getBimServer(),query,Collections.singleton(roid),packageMetaData);
      next=queryObjectProvider.next();
      while (next != null) {
        IdEObject idEObject=ifcModel.get(next.getOid());
        if (idEObject.eClass() != next.eClass()) {
          throw new RuntimeException("String_Node_Str");
        }
        for (        EReference eReference : idEObject.eClass().getEAllReferences()) {
          if (eReference.isMany()) {
            List refOids=(List)next.eGet(eReference);
            AbstractEList<IdEObject> list=(AbstractEList<IdEObject>)idEObject.eGet(eReference);
            if (refOids != null) {
              for (              Object refOid : refOids) {
                if (refOid instanceof Long) {
                  IdEObject ref=ifcModel.get((long)refOid);
                  if (ref != null) {
                    list.addUnique(ref);
                  }
                }
 else                 if (refOid instanceof HashMapWrappedVirtualObject) {
                }
              }
            }
          }
 else {
            Object r=next.eGet(eReference);
            if (r instanceof Long) {
              long refOid=(Long)r;
              idEObject.eSet(eReference,ifcModel.get(refOid));
            }
 else             if (r instanceof HashMapWrappedVirtualObject) {
              HashMapWrappedVirtualObject hashMapWrappedVirtualObject=(HashMapWrappedVirtualObject)r;
              IdEObject embeddedObject=ifcModel.create(hashMapWrappedVirtualObject.eClass());
              idEObject.eSet(eReference,embeddedObject);
              for (              EAttribute eAttribute : hashMapWrappedVirtualObject.eClass().getEAllAttributes()) {
                embeddedObject.eSet(eAttribute,hashMapWrappedVirtualObject.eGet(eAttribute));
              }
            }
          }
        }
        next=queryObjectProvider.next();
      }
      ifcModel.getModelMetaData().setName(name);
      ifcModel.getModelMetaData().setRevisionId(1);
      if (getAuthorization().getUoid() != -1) {
        ifcModel.getModelMetaData().setAuthorizedUser(getUserByUoid(getAuthorization().getUoid()).getName());
      }
      ifcModel.getModelMetaData().setDate(new Date());
    }
 catch (    IOException e1) {
      e1.printStackTrace();
    }
catch (    IfcModelInterfaceException e) {
      e.printStackTrace();
    }
catch (    QueryException e) {
      e.printStackTrace();
    }
  }
  IfcModelInterface ifcModel=new ServerIfcModel(lastPackageMetaData,pidRoidMap,0,getDatabaseSession());
  if (ifcModelSet.size() > 1) {
    setProgress("String_Node_Str",-1);
    try {
      ifcModel=getBimServer().getMergerFactory().createMerger(getDatabaseSession(),getAuthorization().getUoid()).merge(lastProject,ifcModelSet,new ModelHelper(getBimServer().getMetaDataManager(),ifcModel));
    }
 catch (    MergeException e) {
      throw new UserException(e);
    }
  }
 else {
    ifcModel=ifcModelSet.iterator().next();
  }
  ifcModel.getModelMetaData().setName(name);
  if (getAuthorization().getUoid() != -1) {
    ifcModel.getModelMetaData().setAuthorizedUser(getUserByUoid(getAuthorization().getUoid()).getName());
  }
  ifcModel.getModelMetaData().setDate(new Date());
  return ifcModel;
}