Program: 160473
Project: 160473
Buggy source:
@Override public void run(){
  targetModel.generateMinimalExpressIds();
  Serializer ifcSerializer=ifcSerializerPlugin.createSerializer(new PluginConfiguration());
  RenderEngine renderEngine=null;
  try {
    renderEngine=renderEnginePlugin.createRenderEngine(new PluginConfiguration(),model.getPackageMetaData().getSchema().getEPackageName());
  }
 catch (  RenderEngineException e) {
    LOGGER.error("String_Node_Str",e);
  }
  try {
    renderEngine.init();
    ifcSerializer.init(targetModel,null,bimServer.getPluginManager(),null,model.getPackageMetaData(),true);
    boolean debug=false;
    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) {
          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=packageMetaData.create(GeometryInfo.class);
                model.add(oidCounter.incrementAndGet(),geometryInfo);
              }
 else {
                geometryInfo=GeometryFactory.eINSTANCE.createGeometryInfo();
              }
              geometryInfo.setMinBounds(createVector3f(packageMetaData,model,oidCounter,Float.POSITIVE_INFINITY,databaseSession,store,pid,rid));
              geometryInfo.setMaxBounds(createVector3f(packageMetaData,model,oidCounter,Float.NEGATIVE_INFINITY,databaseSession,store,pid,rid));
              GeometryData geometryData=null;
              if (store) {
                geometryData=packageMetaData.create(GeometryData.class);
                model.add(oidCounter.incrementAndGet(),geometryData);
              }
 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));
                }
              }
              float[] tranformationMatrix=new float[16];
              if (translate && renderEngineInstance.getTransformationMatrix() != null) {
                tranformationMatrix=renderEngineInstance.getTransformationMatrix();
              }
 else {
                Matrix.setIdentityM(tranformationMatrix,0);
              }
              for (int i=0; i < geometry.getIndices().length; i++) {
                processExtends(geometryInfo,tranformationMatrix,geometry.getVertices(),geometry.getIndices()[i] * 3);
              }
              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) {
            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|RenderEngineException|IOException e) {
    LOGGER.error("String_Node_Str",e);
  }
 finally {
    try {
      renderEngine.close();
    }
 catch (    RenderEngineException e) {
      LOGGER.error("String_Node_Str",e);
    }
  }
}

Fixed version (ground truth):
@Override public void run(){
  targetModel.generateMinimalExpressIds();
  Serializer ifcSerializer=ifcSerializerPlugin.createSerializer(new PluginConfiguration());
  RenderEngine renderEngine=null;
  try {
    renderEngine=renderEnginePlugin.createRenderEngine(new PluginConfiguration(),model.getPackageMetaData().getSchema().getEPackageName());
  }
 catch (  RenderEngineException e) {
    LOGGER.error("String_Node_Str",e);
  }
  try {
    renderEngine.init();
    ifcSerializer.init(targetModel,null,bimServer.getPluginManager(),null,model.getPackageMetaData(),true);
    boolean debug=false;
    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) {
          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=packageMetaData.create(GeometryInfo.class);
                model.add(databaseSession.newOid(GeometryPackage.eINSTANCE.getGeometryInfo()),geometryInfo);
              }
 else {
                geometryInfo=GeometryFactory.eINSTANCE.createGeometryInfo();
              }
              geometryInfo.setMinBounds(createVector3f(packageMetaData,model,oidCounter,Float.POSITIVE_INFINITY,databaseSession,store,pid,rid));
              geometryInfo.setMaxBounds(createVector3f(packageMetaData,model,oidCounter,Float.NEGATIVE_INFINITY,databaseSession,store,pid,rid));
              GeometryData geometryData=null;
              if (store) {
                geometryData=packageMetaData.create(GeometryData.class);
                model.add(databaseSession.newOid(GeometryPackage.eINSTANCE.getGeometryData()),geometryData);
              }
 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));
                }
              }
              float[] tranformationMatrix=new float[16];
              if (translate && renderEngineInstance.getTransformationMatrix() != null) {
                tranformationMatrix=renderEngineInstance.getTransformationMatrix();
              }
 else {
                Matrix.setIdentityM(tranformationMatrix,0);
              }
              for (int i=0; i < geometry.getIndices().length; i++) {
                processExtends(geometryInfo,tranformationMatrix,geometry.getVertices(),geometry.getIndices()[i] * 3);
              }
              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) {
            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|RenderEngineException|IOException e) {
    LOGGER.error("String_Node_Str",e);
  }
 finally {
    try {
      renderEngine.close();
    }
 catch (    RenderEngineException e) {
      LOGGER.error("String_Node_Str",e);
    }
  }
}