Program: 160434
Project: 160434
Buggy source:
@Override public void run(){
  targetModel.generateMinimalExpressIds();
  Serializer ifcSerializer=ifcSerializerPlugin.createSerializer(new PluginConfiguration());
  RenderEnginePool pool=null;
  RenderEngine renderEngine=null;
  try {
    pool=bimServer.getRenderEnginePools().getRenderEnginePool(model.getPackageMetaData().getSchema(),renderEnginePluginClassName);
    renderEngine=pool.request();
    renderEngine.init();
    ifcSerializer.init(targetModel,null,bimServer.getPluginManager(),model.getPackageMetaData(),true);
    boolean debug=true;
    InputStream in=null;
    if (debug) {
      File file=new File((eClass == null ? "String_Node_Str" : eClass.getName()) + "String_Node_Str");
      FileOutputStream fos=new FileOutputStream(file);
      IOUtils.copy(ifcSerializer.getInputStream(),fos);
      fos.close();
      in=new FileInputStream(file);
    }
 else {
      in=ifcSerializer.getInputStream();
    }
    RenderEngineModel renderEngineModel=renderEngine.openModel(in);
    try {
      renderEngineModel.setSettings(renderEngineSettings);
      renderEngineModel.setFilter(renderEngineFilter);
      renderEngineModel.generateGeneralGeometry();
      List<IdEObject> allWithSubTypes=null;
      if (eClass == null) {
        allWithSubTypes=targetModel.getAllWithSubTypes(packageMetaData.getEClass("String_Node_Str"));
      }
 else {
        allWithSubTypes=targetModel.getAll(eClass);
      }
      for (      IdEObject ifcProduct : allWithSubTypes) {
        IdEObject representation=(IdEObject)ifcProduct.eGet(representationFeature);
        if (representation != null && ((List<?>)representation.eGet(representationsFeature)).size() > 0) {
          List<?> representations=(List<?>)representation.eGet(representationsFeature);
          try {
            RenderEngineInstance renderEngineInstance=renderEngineModel.getInstanceFromExpressId(ifcProduct.getExpressId());
            RenderEngineGeometry geometry=renderEngineInstance.generateGeometry();
            boolean translate=true;
            if (geometry == null || geometry.getIndices().length == 0) {
              renderEngineModel.setFilter(renderEngineFilterTransformed);
              geometry=renderEngineInstance.generateGeometry();
              if (geometry != null) {
                translate=false;
              }
              renderEngineModel.setFilter(renderEngineFilter);
            }
            if (geometry != null && geometry.getNrIndices() > 0) {
              GeometryInfo geometryInfo=null;
              if (store) {
                geometryInfo=model.createAndAdd(GeometryPackage.eINSTANCE.getGeometryInfo(),databaseSession.newOid(GeometryPackage.eINSTANCE.getGeometryInfo()));
                databaseSession.store(geometryInfo,pid,rid);
              }
 else {
                geometryInfo=GeometryFactory.eINSTANCE.createGeometryInfo();
              }
              geometryInfo.setMinBounds(createVector3f(packageMetaData,model,Float.POSITIVE_INFINITY,databaseSession,store,pid,rid));
              geometryInfo.setMaxBounds(createVector3f(packageMetaData,model,Float.NEGATIVE_INFINITY,databaseSession,store,pid,rid));
              try {
                double area=renderEngineInstance.getArea();
                geometryInfo.setArea(area);
                double volume=renderEngineInstance.getVolume();
                if (volume < 0d) {
                  volume=-volume;
                }
                geometryInfo.setVolume(volume);
              }
 catch (              UnsupportedOperationException e) {
              }
              GeometryData geometryData=null;
              if (store) {
                geometryData=model.createAndAdd(GeometryPackage.eINSTANCE.getGeometryData(),databaseSession.newOid(GeometryPackage.eINSTANCE.getGeometryData()));
                databaseSession.store(geometryData,pid,rid);
              }
 else {
                geometryData=GeometryFactory.eINSTANCE.createGeometryData();
              }
              geometryData.setIndices(intArrayToByteArray(geometry.getIndices()));
              geometryData.setVertices(floatArrayToByteArray(geometry.getVertices()));
              geometryData.setMaterialIndices(intArrayToByteArray(geometry.getMaterialIndices()));
              geometryData.setNormals(floatArrayToByteArray(geometry.getNormals()));
              geometryInfo.setPrimitiveCount(geometry.getIndices().length / 3);
              if (geometry.getMaterialIndices() != null && geometry.getMaterialIndices().length > 0) {
                boolean hasMaterial=false;
                float[] vertex_colors=new float[geometry.getVertices().length / 3 * 4];
                for (int i=0; i < geometry.getMaterialIndices().length; ++i) {
                  int c=geometry.getMaterialIndices()[i];
                  for (int j=0; j < 3; ++j) {
                    int k=geometry.getIndices()[i * 3 + j];
                    if (c > -1) {
                      hasMaterial=true;
                      for (int l=0; l < 4; ++l) {
                        vertex_colors[4 * k + l]=geometry.getMaterials()[4 * c + l];
                      }
                    }
                  }
                }
                if (hasMaterial) {
                  geometryData.setMaterials(floatArrayToByteArray(vertex_colors));
                }
              }
              double[] tranformationMatrix=new double[16];
              Matrix.setIdentityM(tranformationMatrix,0);
              if (translate && renderEngineInstance.getTransformationMatrix() != null) {
                tranformationMatrix=renderEngineInstance.getTransformationMatrix();
              }
              for (int i=0; i < geometry.getIndices().length; i++) {
                processExtends(geometryInfo,tranformationMatrix,geometry.getVertices(),geometry.getIndices()[i] * 3,generateGeometryResult);
              }
              geometryInfo.setData(geometryData);
              long length=(geometryData.getIndices() != null ? geometryData.getIndices().length : 0) + (geometryData.getVertices() != null ? geometryData.getVertices().length : 0) + (geometryData.getNormals() != null ? geometryData.getNormals().length : 0)+ (geometryData.getMaterials() != null ? geometryData.getMaterials().length : 0)+ (geometryData.getMaterialIndices() != null ? geometryData.getMaterialIndices().length : 0);
              setTransformationMatrix(geometryInfo,tranformationMatrix);
              if (bimServer.getServerSettingsCache().getServerSettings().isReuseGeometry()) {
                int hash=hash(geometryData);
                if (hashes.containsKey(hash)) {
                  databaseSession.removeFromCommit(geometryData);
                  geometryInfo.setData(hashes.get(hash));
                  bytesSaved.addAndGet(length);
                }
 else {
                  hashes.put(hash,geometryData);
                }
              }
              totalBytes.addAndGet(length);
              if (bigMap == null) {
                ifcProduct.eSet(geometryFeature,geometryInfo);
                if (store) {
                  databaseSession.store(ifcProduct,pid,rid);
                }
              }
 else {
                bigMap.get(ifcProduct).eSet(geometryFeature,geometryInfo);
                ifcProduct.eSet(geometryFeature,geometryInfo);
                if (store) {
                  databaseSession.store(bigMap.get(ifcProduct),pid,rid);
                }
              }
            }
          }
 catch (          EntityNotFoundException e) {
            boolean ignoreNotFound=true;
            for (            Object rep : representations) {
              if (rep instanceof IfcShapeRepresentation) {
                IfcShapeRepresentation ifcShapeRepresentation=(IfcShapeRepresentation)rep;
                if (!"String_Node_Str".equals(ifcShapeRepresentation.getRepresentationType())) {
                  ignoreNotFound=false;
                }
              }
            }
            if (!ignoreNotFound) {
              LOGGER.info("String_Node_Str" + ifcProduct.eClass().getName() + "String_Node_Str"+ ifcProduct.getExpressId()+ "String_Node_Str"+ ifcProduct.getOid());
            }
          }
catch (          BimserverDatabaseException|RenderEngineException e) {
            LOGGER.error("String_Node_Str",e);
          }
catch (          IfcModelInterfaceException e) {
            LOGGER.error("String_Node_Str",e);
          }
        }
      }
    }
  finally {
      in.close();
      renderEngineModel.close();
    }
  }
 catch (  SerializerException|IOException|InterruptedException|PluginException e) {
    LOGGER.error("String_Node_Str",e);
  }
 finally {
    pool.release(renderEngine);
  }
}

Fixed version (ground truth):
@Override public void run(){
  targetModel.generateMinimalExpressIds();
  Serializer ifcSerializer=ifcSerializerPlugin.createSerializer(new PluginConfiguration());
  RenderEnginePool pool=null;
  RenderEngine renderEngine=null;
  try {
    pool=bimServer.getRenderEnginePools().getRenderEnginePool(model.getPackageMetaData().getSchema(),renderEnginePluginClassName);
    renderEngine=pool.request();
    renderEngine.init();
    ifcSerializer.init(targetModel,null,bimServer.getPluginManager(),model.getPackageMetaData(),true);
    boolean debug=true;
    InputStream in=null;
    if (debug) {
      File file=new File((eClass == null ? "String_Node_Str" : eClass.getName()) + "String_Node_Str");
      FileOutputStream fos=new FileOutputStream(file);
      IOUtils.copy(ifcSerializer.getInputStream(),fos);
      fos.close();
      in=new FileInputStream(file);
    }
 else {
      in=ifcSerializer.getInputStream();
    }
    RenderEngineModel renderEngineModel=renderEngine.openModel(in);
    try {
      renderEngineModel.setSettings(renderEngineSettings);
      renderEngineModel.setFilter(renderEngineFilter);
      renderEngineModel.generateGeneralGeometry();
      List<IdEObject> allWithSubTypes=null;
      if (eClass == null) {
        allWithSubTypes=targetModel.getAllWithSubTypes(packageMetaData.getEClass("String_Node_Str"));
      }
 else {
        allWithSubTypes=targetModel.getAll(eClass);
      }
      for (      IdEObject ifcProduct : allWithSubTypes) {
        IdEObject representation=(IdEObject)ifcProduct.eGet(representationFeature);
        if (representation != null && ((List<?>)representation.eGet(representationsFeature)).size() > 0) {
          List<?> representations=(List<?>)representation.eGet(representationsFeature);
          try {
            RenderEngineInstance renderEngineInstance=renderEngineModel.getInstanceFromExpressId(ifcProduct.getExpressId());
            RenderEngineGeometry geometry=renderEngineInstance.generateGeometry();
            boolean translate=true;
            if (geometry == null || geometry.getIndices().length == 0) {
              renderEngineModel.setFilter(renderEngineFilterTransformed);
              geometry=renderEngineInstance.generateGeometry();
              if (geometry != null) {
                translate=false;
              }
              renderEngineModel.setFilter(renderEngineFilter);
            }
            if (geometry != null && geometry.getNrIndices() > 0) {
              GeometryInfo geometryInfo=null;
              if (store) {
                geometryInfo=model.createAndAdd(GeometryPackage.eINSTANCE.getGeometryInfo(),databaseSession.newOid(GeometryPackage.eINSTANCE.getGeometryInfo()));
                databaseSession.store(geometryInfo,pid,rid);
              }
 else {
                geometryInfo=GeometryFactory.eINSTANCE.createGeometryInfo();
              }
              geometryInfo.setMinBounds(createVector3f(packageMetaData,model,Float.POSITIVE_INFINITY,databaseSession,store,pid,rid));
              geometryInfo.setMaxBounds(createVector3f(packageMetaData,model,Float.NEGATIVE_INFINITY,databaseSession,store,pid,rid));
              try {
                double area=renderEngineInstance.getArea();
                geometryInfo.setArea(area);
                double volume=renderEngineInstance.getVolume();
                if (volume < 0d) {
                  volume=-volume;
                }
                geometryInfo.setVolume(volume);
              }
 catch (              UnsupportedOperationException e) {
              }
              GeometryData geometryData=null;
              if (store) {
                geometryData=model.createAndAdd(GeometryPackage.eINSTANCE.getGeometryData(),databaseSession.newOid(GeometryPackage.eINSTANCE.getGeometryData()));
                databaseSession.store(geometryData,pid,rid);
              }
 else {
                geometryData=GeometryFactory.eINSTANCE.createGeometryData();
              }
              geometryData.setIndices(intArrayToByteArray(geometry.getIndices()));
              geometryData.setVertices(floatArrayToByteArray(geometry.getVertices()));
              geometryData.setMaterialIndices(intArrayToByteArray(geometry.getMaterialIndices()));
              geometryData.setNormals(floatArrayToByteArray(geometry.getNormals()));
              geometryInfo.setPrimitiveCount(geometry.getIndices().length / 3);
              if (geometry.getMaterialIndices() != null && geometry.getMaterialIndices().length > 0) {
                boolean hasMaterial=false;
                float[] vertex_colors=new float[geometry.getVertices().length / 3 * 4];
                for (int i=0; i < geometry.getMaterialIndices().length; ++i) {
                  int c=geometry.getMaterialIndices()[i];
                  for (int j=0; j < 3; ++j) {
                    int k=geometry.getIndices()[i * 3 + j];
                    if (c > -1) {
                      hasMaterial=true;
                      for (int l=0; l < 4; ++l) {
                        vertex_colors[4 * k + l]=geometry.getMaterials()[4 * c + l];
                      }
                    }
                  }
                }
                if (hasMaterial) {
                  geometryData.setMaterials(floatArrayToByteArray(vertex_colors));
                }
              }
              double[] tranformationMatrix=new double[16];
              Matrix.setIdentityM(tranformationMatrix,0);
              if (translate && renderEngineInstance.getTransformationMatrix() != null) {
                tranformationMatrix=renderEngineInstance.getTransformationMatrix();
              }
              for (int i=0; i < geometry.getIndices().length; i++) {
                processExtends(geometryInfo,tranformationMatrix,geometry.getVertices(),geometry.getIndices()[i] * 3,generateGeometryResult);
              }
              geometryInfo.setData(geometryData);
              long length=(geometryData.getIndices() != null ? geometryData.getIndices().length : 0) + (geometryData.getVertices() != null ? geometryData.getVertices().length : 0) + (geometryData.getNormals() != null ? geometryData.getNormals().length : 0)+ (geometryData.getMaterials() != null ? geometryData.getMaterials().length : 0)+ (geometryData.getMaterialIndices() != null ? geometryData.getMaterialIndices().length : 0);
              setTransformationMatrix(geometryInfo,tranformationMatrix);
              if (bimServer.getServerSettingsCache().getServerSettings().isReuseGeometry()) {
                int hash=hash(geometryData);
                if (hashes.containsKey(hash)) {
                  databaseSession.removeFromCommit(geometryData);
                  geometryInfo.setData(hashes.get(hash));
                  bytesSaved.addAndGet(length);
                }
 else {
                  hashes.put(hash,geometryData);
                }
              }
              totalBytes.addAndGet(length);
              if (bigMap == null) {
                ifcProduct.eSet(geometryFeature,geometryInfo);
                if (store) {
                  databaseSession.store(ifcProduct,pid,rid);
                }
              }
 else {
                bigMap.get(ifcProduct).eSet(geometryFeature,geometryInfo);
                ifcProduct.eSet(geometryFeature,geometryInfo);
                if (store) {
                  databaseSession.store(bigMap.get(ifcProduct),pid,rid);
                }
              }
            }
          }
 catch (          EntityNotFoundException e) {
            boolean ignoreNotFound=true;
            for (            Object rep : representations) {
              if (rep instanceof IfcShapeRepresentation) {
                IfcShapeRepresentation ifcShapeRepresentation=(IfcShapeRepresentation)rep;
                if (!"String_Node_Str".equals(ifcShapeRepresentation.getRepresentationType())) {
                  ignoreNotFound=false;
                }
              }
            }
            if (!ignoreNotFound) {
              LOGGER.info("String_Node_Str" + ifcProduct.eClass().getName() + "String_Node_Str"+ ifcProduct.getExpressId()+ "String_Node_Str"+ ifcProduct.getOid());
            }
          }
catch (          BimserverDatabaseException|RenderEngineException e) {
            LOGGER.error("String_Node_Str",e);
          }
catch (          IfcModelInterfaceException e) {
            LOGGER.error("String_Node_Str",e);
          }
        }
      }
    }
  finally {
      in.close();
      renderEngineModel.close();
    }
  }
 catch (  SerializerException|IOException|InterruptedException|PluginException e) {
    LOGGER.error("String_Node_Str",e);
  }
 finally {
    if (pool != null && renderEngine != null) {
      pool.release(renderEngine);
    }
  }
}