Program: 160376
Project: 160376
Buggy source:
@SuppressWarnings("String_Node_Str") @Override public IfcModelInterface execute() throws UserException, BimserverLockConflictException, BimserverDatabaseException {
  long roid=roids.iterator().next();
  Revision revision=getDatabaseSession().get(StorePackage.eINSTANCE.getRevision(),roid,OldQuery.getDefault());
  PackageMetaData packageMetaData=getBimServer().getMetaDataManager().getPackageMetaData(revision.getProject().getSchema());
  JsonQueryObjectModelConverter converter=new JsonQueryObjectModelConverter(packageMetaData);
  ObjectNode queryObject;
  try {
    queryObject=new ObjectMapper().readValue(json,ObjectNode.class);
    Query query=converter.parseJson("String_Node_Str",(ObjectNode)queryObject);
    IfcModelInterface ifcModel=new ServerIfcModel(packageMetaData,null,getDatabaseSession());
    QueryObjectProvider queryObjectProvider=new QueryObjectProvider(getDatabaseSession(),getBimServer(),query,roids,packageMetaData);
    HashMapVirtualObject next=queryObjectProvider.next();
    while (next != null) {
      IdEObject newObject=packageMetaData.create(next.eClass());
      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,roids,packageMetaData);
    next=queryObjectProvider.next();
    while (next != null) {
      IdEObject idEObject=ifcModel.get(next.getOid());
      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 {
          long refOid=(long)next.eGet(eReference);
          idEObject.eSet(eReference,ifcModel.get(refOid));
        }
      }
      next=queryObjectProvider.next();
    }
    String name="String_Node_Str";
    ifcModel.getModelMetaData().setName(name);
    ifcModel.getModelMetaData().setRevisionId(1);
    if (getAuthorization().getUoid() != -1) {
      ifcModel.getModelMetaData().setAuthorizedUser(getUserByUoid(getAuthorization().getUoid()).getName());
    }
    ifcModel.getModelMetaData().setDate(new Date());
    return ifcModel;
  }
 catch (  IOException e1) {
    e1.printStackTrace();
  }
catch (  IfcModelInterfaceException e) {
    e.printStackTrace();
  }
catch (  QueryException e) {
    e.printStackTrace();
  }
  return null;
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override public IfcModelInterface execute() throws UserException, BimserverLockConflictException, BimserverDatabaseException {
  List<String> projectNames=new ArrayList<>();
  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);
  long roid=roids.iterator().next();
  Revision revision=getDatabaseSession().get(StorePackage.eINSTANCE.getRevision(),roid,OldQuery.getDefault());
  PackageMetaData packageMetaData=getBimServer().getMetaDataManager().getPackageMetaData(revision.getProject().getSchema());
  JsonQueryObjectModelConverter converter=new JsonQueryObjectModelConverter(packageMetaData);
  ObjectNode queryObject;
  try {
    queryObject=new ObjectMapper().readValue(json,ObjectNode.class);
    Query query=converter.parseJson("String_Node_Str",(ObjectNode)queryObject);
    IfcModelInterface ifcModel=new ServerIfcModel(packageMetaData,null,getDatabaseSession());
    QueryObjectProvider queryObjectProvider=new QueryObjectProvider(getDatabaseSession(),getBimServer(),query,roids,packageMetaData);
    HashMapVirtualObject next=queryObjectProvider.next();
    while (next != null) {
      IdEObject newObject=packageMetaData.create(next.eClass());
      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,roids,packageMetaData);
    next=queryObjectProvider.next();
    while (next != null) {
      IdEObject idEObject=ifcModel.get(next.getOid());
      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 {
          long refOid=(long)next.eGet(eReference);
          idEObject.eSet(eReference,ifcModel.get(refOid));
        }
      }
      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());
    return ifcModel;
  }
 catch (  IOException e1) {
    e1.printStackTrace();
  }
catch (  IfcModelInterfaceException e) {
    e.printStackTrace();
  }
catch (  QueryException e) {
    e.printStackTrace();
  }
  return null;
}