Program: 160520
Project: 160520
Buggy source:
@Override public IfcModelInterface execute() throws UserException, BimserverLockConflictException, BimserverDatabaseException {
  IfcModelSet ifcModelSet=new IfcModelSet();
  User user=getUserByUoid(getAuthorization().getUoid());
  Project project=null;
  SerializerPluginConfiguration serializerPluginConfiguration=getDatabaseSession().get(StorePackage.eINSTANCE.getSerializerPluginConfiguration(),serializerOid,Query.getDefault());
  String name="String_Node_Str";
  for (  Long roid : roids) {
    Revision virtualRevision=getRevisionByRoid(roid);
    project=virtualRevision.getProject();
    name+=project.getName() + "String_Node_Str" + virtualRevision.getId()+ "String_Node_Str";
    try {
      getAuthorization().canDownload(roid);
    }
 catch (    UserException e) {
      if (!getAuthorization().hasRightsOnProjectOrSuperProjectsOrSubProjects(user,project)) {
        throw new UserException("String_Node_Str");
      }
      if (!getAuthorization().hasRightsOnProjectOrSuperProjectsOrSubProjects(user,project)) {
        throw new UserException("String_Node_Str");
      }
    }
    int size=0;
    JsonParser parser=new JsonParser();
    JsonElement query=parser.parse(json);
    for (    ConcreteRevision concreteRevision : virtualRevision.getConcreteRevisions()) {
      try {
        int highestStopId=findHighestStopRid(project,concreteRevision);
        IfcModelInterface subModel=new IfcModel();
        Query databaseQuery=new Query(concreteRevision.getProject().getId(),concreteRevision.getId(),null,Deep.NO,highestStopId);
        JsonObject queryObject=(JsonObject)query;
        JsonArray queries=queryObject.get("String_Node_Str").getAsJsonArray();
        for (        JsonElement queryElement : queries) {
          processQueryPart(queryObject,(JsonObject)queryElement,subModel,databaseQuery);
        }
        size+=subModel.size();
        subModel.getModelMetaData().setDate(concreteRevision.getDate());
        checkGeometry(serializerPluginConfiguration,getBimServer().getPluginManager(),subModel,project,concreteRevision,virtualRevision);
        ifcModelSet.add(subModel);
      }
 catch (      GeometryGeneratingException|IfcModelInterfaceException e) {
        throw new UserException(e);
      }
    }
    IfcModelInterface ifcModel=new IfcModel(size);
    if (ifcModelSet.size() > 1) {
      try {
        ifcModel=getBimServer().getMergerFactory().createMerger(getDatabaseSession(),getAuthorization().getUoid()).merge(project,ifcModelSet,new ModelHelper(ifcModel));
      }
 catch (      MergeException e) {
        throw new UserException(e);
      }
    }
 else {
      ifcModel=ifcModelSet.iterator().next();
    }
    ifcModel.getModelMetaData().setName("String_Node_Str");
    ifcModel.getModelMetaData().setRevisionId(project.getRevisions().indexOf(virtualRevision) + 1);
    if (getAuthorization().getUoid() != -1) {
      ifcModel.getModelMetaData().setAuthorizedUser(getUserByUoid(getAuthorization().getUoid()).getName());
    }
    ifcModel.getModelMetaData().setDate(virtualRevision.getDate());
  }
  IfcModelInterface ifcModel=new IfcModel();
  if (ifcModelSet.size() > 1) {
    try {
      ifcModel=getBimServer().getMergerFactory().createMerger(getDatabaseSession(),getAuthorization().getUoid()).merge(project,ifcModelSet,new ModelHelper(ifcModel));
    }
 catch (    MergeException e) {
      throw new UserException(e);
    }
  }
 else {
    ifcModel=ifcModelSet.iterator().next();
  }
  if (name.endsWith("String_Node_Str")) {
    name=name.substring(0,name.length() - 1);
  }
  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;
}

Fixed version (ground truth):
@Override public IfcModelInterface execute() throws UserException, BimserverLockConflictException, BimserverDatabaseException {
  IfcModelSet ifcModelSet=new IfcModelSet();
  User user=getUserByUoid(getAuthorization().getUoid());
  Project project=null;
  SerializerPluginConfiguration serializerPluginConfiguration=getDatabaseSession().get(StorePackage.eINSTANCE.getSerializerPluginConfiguration(),serializerOid,Query.getDefault());
  String name="String_Node_Str";
  for (  Long roid : roids) {
    Revision virtualRevision=getRevisionByRoid(roid);
    project=virtualRevision.getProject();
    name+=project.getName() + "String_Node_Str" + virtualRevision.getId()+ "String_Node_Str";
    try {
      getAuthorization().canDownload(roid);
    }
 catch (    UserException e) {
      if (!getAuthorization().hasRightsOnProjectOrSuperProjectsOrSubProjects(user,project)) {
        throw new UserException("String_Node_Str");
      }
      if (!getAuthorization().hasRightsOnProjectOrSuperProjectsOrSubProjects(user,project)) {
        throw new UserException("String_Node_Str");
      }
    }
    int size=0;
    JsonParser parser=new JsonParser();
    JsonElement query=parser.parse(json);
    for (    ConcreteRevision concreteRevision : virtualRevision.getConcreteRevisions()) {
      try {
        int highestStopId=findHighestStopRid(project,concreteRevision);
        IfcModelInterface subModel=new IfcModel();
        Query databaseQuery=new Query(concreteRevision.getProject().getId(),concreteRevision.getId(),null,Deep.NO,highestStopId);
        JsonObject queryObject=(JsonObject)query;
        JsonArray queries=queryObject.get("String_Node_Str").getAsJsonArray();
        for (        JsonElement queryElement : queries) {
          processQueryPart(queryObject,(JsonObject)queryElement,subModel,databaseQuery);
        }
        size+=subModel.size();
        subModel.getModelMetaData().setDate(concreteRevision.getDate());
        subModel.fixInverseMismatches();
        checkGeometry(serializerPluginConfiguration,getBimServer().getPluginManager(),subModel,project,concreteRevision,virtualRevision);
        ifcModelSet.add(subModel);
      }
 catch (      GeometryGeneratingException|IfcModelInterfaceException e) {
        throw new UserException(e);
      }
    }
    IfcModelInterface ifcModel=new IfcModel(size);
    if (ifcModelSet.size() > 1) {
      try {
        ifcModel=getBimServer().getMergerFactory().createMerger(getDatabaseSession(),getAuthorization().getUoid()).merge(project,ifcModelSet,new ModelHelper(ifcModel));
      }
 catch (      MergeException e) {
        throw new UserException(e);
      }
    }
 else {
      ifcModel=ifcModelSet.iterator().next();
    }
    ifcModel.getModelMetaData().setName("String_Node_Str");
    ifcModel.getModelMetaData().setRevisionId(project.getRevisions().indexOf(virtualRevision) + 1);
    if (getAuthorization().getUoid() != -1) {
      ifcModel.getModelMetaData().setAuthorizedUser(getUserByUoid(getAuthorization().getUoid()).getName());
    }
    ifcModel.getModelMetaData().setDate(virtualRevision.getDate());
  }
  IfcModelInterface ifcModel=new IfcModel();
  if (ifcModelSet.size() > 1) {
    try {
      ifcModel=getBimServer().getMergerFactory().createMerger(getDatabaseSession(),getAuthorization().getUoid()).merge(project,ifcModelSet,new ModelHelper(ifcModel));
    }
 catch (    MergeException e) {
      throw new UserException(e);
    }
  }
 else {
    ifcModel=ifcModelSet.iterator().next();
  }
  if (name.endsWith("String_Node_Str")) {
    name=name.substring(0,name.length() - 1);
  }
  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;
}