Program: 160344
Project: 160344
Buggy source:
public GenerateGeometryResult generateGeometry(long uoid,final DatabaseSession databaseSession,QueryContext queryContext) throws BimserverDatabaseException, GeometryGeneratingException {
  GenerateGeometryResult generateGeometryResult=new GenerateGeometryResult();
  packageMetaData=queryContext.getPackageMetaData();
  productClass=packageMetaData.getEClass("String_Node_Str");
  geometryFeature=productClass.getEStructuralFeature("String_Node_Str");
  representationFeature=productClass.getEStructuralFeature("String_Node_Str");
  productRepresentationClass=packageMetaData.getEClass("String_Node_Str");
  representationsFeature=productRepresentationClass.getEStructuralFeature("String_Node_Str");
  long start=System.nanoTime();
  String pluginName="String_Node_Str";
  if (queryContext.getPackageMetaData().getSchema() == Schema.IFC4) {
    pluginName="String_Node_Str";
  }
 else   if (queryContext.getPackageMetaData().getSchema() == Schema.IFC2X3TC1) {
    pluginName="String_Node_Str";
  }
  try {
    final StreamingSerializerPlugin ifcSerializerPlugin=(StreamingSerializerPlugin)bimServer.getPluginManager().getPlugin(pluginName,true);
    if (ifcSerializerPlugin == null) {
      throw new UserException("String_Node_Str");
    }
    User user=(User)databaseSession.get(uoid,org.bimserver.database.OldQuery.getDefault());
    UserSettings userSettings=user.getUserSettings();
    RenderEnginePluginConfiguration defaultRenderEngine=userSettings.getDefaultRenderEngine();
    if (defaultRenderEngine == null) {
      throw new UserException("String_Node_Str");
    }
    int maxSimultanousThreads=Math.min(bimServer.getServerSettingsCache().getServerSettings().getRenderEngineProcesses(),Runtime.getRuntime().availableProcessors());
    if (maxSimultanousThreads < 1) {
      maxSimultanousThreads=1;
    }
    final RenderEngineSettings settings=new RenderEngineSettings();
    settings.setPrecision(Precision.SINGLE);
    settings.setIndexFormat(IndexFormat.AUTO_DETECT);
    settings.setGenerateNormals(true);
    settings.setGenerateTriangles(true);
    settings.setGenerateWireFrame(false);
    final RenderEngineFilter renderEngineFilter=new RenderEngineFilter();
    RenderEnginePool renderEnginePool=bimServer.getRenderEnginePools().getRenderEnginePool(packageMetaData.getSchema(),defaultRenderEngine.getPluginDescriptor().getPluginClassName(),new PluginConfiguration(defaultRenderEngine.getSettings()));
    ThreadPoolExecutor executor=new ThreadPoolExecutor(maxSimultanousThreads,maxSimultanousThreads,24,TimeUnit.HOURS,new ArrayBlockingQueue<Runnable>(10000000));
    for (    EClass eClass : queryContext.getOidCounters().keySet()) {
      if (packageMetaData.getEClass("String_Node_Str").isSuperTypeOf(eClass)) {
        Query query2=new Query("String_Node_Str",packageMetaData);
        QueryPart queryPart2=query2.createQueryPart();
        queryPart2.addType(eClass,false);
        Include include=queryPart2.createInclude();
        include.addType(eClass,false);
        include.addFieldDirect("String_Node_Str");
        QueryObjectProvider queryObjectProvider2=new QueryObjectProvider(databaseSession,bimServer,query2,Collections.singleton(queryContext.getRoid()),packageMetaData);
        HashMapVirtualObject next=queryObjectProvider2.next();
        while (next != null) {
          if (next.eClass() == eClass) {
            HashMapVirtualObject representation=next.getDirectFeature(representationFeature);
            if (representation != null) {
              List<Long> representations=(List<Long>)representation.get("String_Node_Str");
              if (!representations.isEmpty()) {
                Query query=new Query("String_Node_Str",packageMetaData);
                QueryPart queryPart=query.createQueryPart();
                queryPart.addType(eClass,false);
                int x=0;
                queryPart.addOid(next.getOid());
                while (next != null && x < 10) {
                  next=queryObjectProvider2.next();
                  if (next != null) {
                    if (next.eClass() == eClass) {
                      representation=next.getDirectFeature(representationFeature);
                      if (representation != null) {
                        representations=(List<Long>)representation.get("String_Node_Str");
                        if (!representations.isEmpty()) {
                          queryPart.addOid(next.getOid());
                          x++;
                        }
                      }
                    }
                  }
                }
                JsonQueryObjectModelConverter jsonQueryObjectModelConverter=new JsonQueryObjectModelConverter(packageMetaData);
                String queryNameSpace="String_Node_Str";
                if (packageMetaData.getSchema() == Schema.IFC4) {
                  queryNameSpace="String_Node_Str";
                }
                if (eClass.getName().equals("String_Node_Str")) {
                  queryPart.addInclude(jsonQueryObjectModelConverter.getDefineFromFile(queryNameSpace + "String_Node_Str"));
                }
 else {
                  queryPart.addInclude(jsonQueryObjectModelConverter.getDefineFromFile(queryNameSpace + "String_Node_Str"));
                }
                queryPart.addInclude(jsonQueryObjectModelConverter.getDefineFromFile(queryNameSpace + "String_Node_Str"));
                queryPart.addInclude(jsonQueryObjectModelConverter.getDefineFromFile(queryNameSpace + "String_Node_Str"));
                Include representationInclude=jsonQueryObjectModelConverter.getDefineFromFile(queryNameSpace + "String_Node_Str");
                queryPart.addInclude(representationInclude);
                Include objectPlacement=jsonQueryObjectModelConverter.getDefineFromFile(queryNameSpace + "String_Node_Str");
                queryPart.addInclude(objectPlacement);
                if (packageMetaData.getEClass("String_Node_Str").isSuperTypeOf(eClass)) {
                  Include ifcWall=queryPart.createInclude();
                  ifcWall.addType(packageMetaData.getEClass(eClass.getName()),false);
                  ifcWall.addField("String_Node_Str");
                  Include hasOpenings=ifcWall.createInclude();
                  hasOpenings.addType(packageMetaData.getEClass("String_Node_Str"),false);
                  hasOpenings.addField("String_Node_Str");
                  hasOpenings.addInclude(representationInclude);
                  hasOpenings.addInclude(objectPlacement);
                }
                QueryObjectProvider queryObjectProvider=new QueryObjectProvider(databaseSession,bimServer,query,Collections.singleton(queryContext.getRoid()),packageMetaData);
                Runner runner=new Runner(eClass,renderEnginePool,databaseSession,settings,queryObjectProvider,ifcSerializerPlugin,renderEngineFilter,generateGeometryResult,queryContext,query);
                executor.submit(runner);
                jobsTotal.incrementAndGet();
              }
            }
          }
          next=queryObjectProvider2.next();
        }
      }
    }
    allJobsPushed=true;
    executor.shutdown();
    executor.awaitTermination(24,TimeUnit.HOURS);
    long end=System.nanoTime();
    LOGGER.info("String_Node_Str" + ((end - start) / 1000000) + "String_Node_Str"+ "String_Node_Str"+ Formatters.bytesToString(bytesSaved.get())+ "String_Node_Str"+ Formatters.bytesToString(totalBytes.get())+ "String_Node_Str"+ Formatters.bytesToString(totalBytes.get() - bytesSaved.get()));
  }
 catch (  Exception e) {
    LOGGER.error("String_Node_Str",e);
    throw new GeometryGeneratingException(e);
  }
  return generateGeometryResult;
}

Fixed version (ground truth):
public GenerateGeometryResult generateGeometry(long uoid,final DatabaseSession databaseSession,QueryContext queryContext) throws BimserverDatabaseException, GeometryGeneratingException {
  GenerateGeometryResult generateGeometryResult=new GenerateGeometryResult();
  packageMetaData=queryContext.getPackageMetaData();
  productClass=packageMetaData.getEClass("String_Node_Str");
  geometryFeature=productClass.getEStructuralFeature("String_Node_Str");
  representationFeature=productClass.getEStructuralFeature("String_Node_Str");
  productRepresentationClass=packageMetaData.getEClass("String_Node_Str");
  representationsFeature=productRepresentationClass.getEStructuralFeature("String_Node_Str");
  long start=System.nanoTime();
  String pluginName="String_Node_Str";
  if (queryContext.getPackageMetaData().getSchema() == Schema.IFC4) {
    pluginName="String_Node_Str";
  }
 else   if (queryContext.getPackageMetaData().getSchema() == Schema.IFC2X3TC1) {
    pluginName="String_Node_Str";
  }
  try {
    final StreamingSerializerPlugin ifcSerializerPlugin=(StreamingSerializerPlugin)bimServer.getPluginManager().getPlugin(pluginName,true);
    if (ifcSerializerPlugin == null) {
      throw new UserException("String_Node_Str");
    }
    User user=(User)databaseSession.get(uoid,org.bimserver.database.OldQuery.getDefault());
    UserSettings userSettings=user.getUserSettings();
    RenderEnginePluginConfiguration defaultRenderEngine=userSettings.getDefaultRenderEngine();
    if (defaultRenderEngine == null) {
      throw new UserException("String_Node_Str");
    }
    int maxSimultanousThreads=Math.min(bimServer.getServerSettingsCache().getServerSettings().getRenderEngineProcesses(),Runtime.getRuntime().availableProcessors());
    if (maxSimultanousThreads < 1) {
      maxSimultanousThreads=1;
    }
    final RenderEngineSettings settings=new RenderEngineSettings();
    settings.setPrecision(Precision.SINGLE);
    settings.setIndexFormat(IndexFormat.AUTO_DETECT);
    settings.setGenerateNormals(true);
    settings.setGenerateTriangles(true);
    settings.setGenerateWireFrame(false);
    final RenderEngineFilter renderEngineFilter=new RenderEngineFilter();
    RenderEnginePool renderEnginePool=bimServer.getRenderEnginePools().getRenderEnginePool(packageMetaData.getSchema(),defaultRenderEngine.getPluginDescriptor().getPluginClassName(),new PluginConfiguration(defaultRenderEngine.getSettings()));
    ThreadPoolExecutor executor=new ThreadPoolExecutor(maxSimultanousThreads,maxSimultanousThreads,24,TimeUnit.HOURS,new ArrayBlockingQueue<Runnable>(10000000));
    for (    EClass eClass : queryContext.getOidCounters().keySet()) {
      if (packageMetaData.getEClass("String_Node_Str").isSuperTypeOf(eClass)) {
        Query query2=new Query("String_Node_Str",packageMetaData);
        QueryPart queryPart2=query2.createQueryPart();
        queryPart2.addType(eClass,false);
        Include include=queryPart2.createInclude();
        include.addType(eClass,false);
        include.addFieldDirect("String_Node_Str");
        QueryObjectProvider queryObjectProvider2=new QueryObjectProvider(databaseSession,bimServer,query2,Collections.singleton(queryContext.getRoid()),packageMetaData);
        HashMapVirtualObject next=queryObjectProvider2.next();
        while (next != null) {
          if (next.eClass() == eClass) {
            HashMapVirtualObject representation=next.getDirectFeature(representationFeature);
            if (representation != null) {
              List<Long> representations=(List<Long>)representation.get("String_Node_Str");
              if (representations != null && !representations.isEmpty()) {
                Query query=new Query("String_Node_Str",packageMetaData);
                QueryPart queryPart=query.createQueryPart();
                queryPart.addType(eClass,false);
                int x=0;
                queryPart.addOid(next.getOid());
                while (next != null && x < 10) {
                  next=queryObjectProvider2.next();
                  if (next != null) {
                    if (next.eClass() == eClass) {
                      representation=next.getDirectFeature(representationFeature);
                      if (representation != null) {
                        representations=(List<Long>)representation.get("String_Node_Str");
                        if (!representations.isEmpty()) {
                          queryPart.addOid(next.getOid());
                          x++;
                        }
                      }
                    }
                  }
                }
                JsonQueryObjectModelConverter jsonQueryObjectModelConverter=new JsonQueryObjectModelConverter(packageMetaData);
                String queryNameSpace="String_Node_Str";
                if (packageMetaData.getSchema() == Schema.IFC4) {
                  queryNameSpace="String_Node_Str";
                }
                if (eClass.getName().equals("String_Node_Str")) {
                  queryPart.addInclude(jsonQueryObjectModelConverter.getDefineFromFile(queryNameSpace + "String_Node_Str"));
                }
 else {
                  queryPart.addInclude(jsonQueryObjectModelConverter.getDefineFromFile(queryNameSpace + "String_Node_Str"));
                }
                queryPart.addInclude(jsonQueryObjectModelConverter.getDefineFromFile(queryNameSpace + "String_Node_Str"));
                queryPart.addInclude(jsonQueryObjectModelConverter.getDefineFromFile(queryNameSpace + "String_Node_Str"));
                Include representationInclude=jsonQueryObjectModelConverter.getDefineFromFile(queryNameSpace + "String_Node_Str");
                queryPart.addInclude(representationInclude);
                Include objectPlacement=jsonQueryObjectModelConverter.getDefineFromFile(queryNameSpace + "String_Node_Str");
                queryPart.addInclude(objectPlacement);
                if (packageMetaData.getEClass("String_Node_Str").isSuperTypeOf(eClass)) {
                  Include ifcWall=queryPart.createInclude();
                  ifcWall.addType(packageMetaData.getEClass(eClass.getName()),false);
                  ifcWall.addField("String_Node_Str");
                  Include hasOpenings=ifcWall.createInclude();
                  hasOpenings.addType(packageMetaData.getEClass("String_Node_Str"),false);
                  hasOpenings.addField("String_Node_Str");
                  hasOpenings.addInclude(representationInclude);
                  hasOpenings.addInclude(objectPlacement);
                }
                QueryObjectProvider queryObjectProvider=new QueryObjectProvider(databaseSession,bimServer,query,Collections.singleton(queryContext.getRoid()),packageMetaData);
                Runner runner=new Runner(eClass,renderEnginePool,databaseSession,settings,queryObjectProvider,ifcSerializerPlugin,renderEngineFilter,generateGeometryResult,queryContext,query);
                executor.submit(runner);
                jobsTotal.incrementAndGet();
              }
            }
          }
          next=queryObjectProvider2.next();
        }
      }
    }
    allJobsPushed=true;
    executor.shutdown();
    executor.awaitTermination(24,TimeUnit.HOURS);
    long end=System.nanoTime();
    LOGGER.info("String_Node_Str" + ((end - start) / 1000000) + "String_Node_Str"+ "String_Node_Str"+ Formatters.bytesToString(bytesSaved.get())+ "String_Node_Str"+ Formatters.bytesToString(totalBytes.get())+ "String_Node_Str"+ Formatters.bytesToString(totalBytes.get() - bytesSaved.get()));
  }
 catch (  Exception e) {
    LOGGER.error("String_Node_Str",e);
    throw new GeometryGeneratingException(e);
  }
  return generateGeometryResult;
}