Program: 160423
Project: 160423
Buggy source:
@Override public void run(){
  StreamingSerializer ifcSerializer=ifcSerializerPlugin.createSerializer(new PluginConfiguration());
  try (RenderEngine renderEngine=renderEnginePlugin.createRenderEngine(new PluginConfiguration(),queryContext.getPackageMetaData().getSchema().getEPackageName())){
    renderEngine.init();
    final Set<HashMapVirtualObject> oids=new HashSet<>();
    ObjectProviderProxy proxy=new ObjectProviderProxy(objectProvider,new ObjectListener(){
      @Override public void newObject(      HashMapVirtualObject next){
        if (eClass.isSuperTypeOf(next.eClass())) {
          oids.add(next);
        }
      }
    }
);
    ifcSerializer.init(proxy,null,null,bimServer.getPluginManager(),packageMetaData);
    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();
      OidConvertingSerializer oidConvertingSerializer=(OidConvertingSerializer)ifcSerializer;
      Map<Long,Integer> oidToEid=oidConvertingSerializer.getOidToEid();
      for (      HashMapVirtualObject ifcProduct : oids) {
        Integer expressId=oidToEid.get(ifcProduct.getOid());
        if (ifcProduct.eGet(representationFeature) != null) {
          try {
            RenderEngineInstance renderEngineInstance=renderEngineModel.getInstanceFromExpressId(expressId);
            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) {
              VirtualObject geometryInfo=new HashMapVirtualObject(queryContext,GeometryPackage.eINSTANCE.getGeometryInfo());
              WrappedVirtualObject minBounds=new HashMapWrappedVirtualObject(queryContext,GeometryPackage.eINSTANCE.getVector3f());
              WrappedVirtualObject maxBounds=new HashMapWrappedVirtualObject(queryContext,GeometryPackage.eINSTANCE.getVector3f());
              minBounds.set("String_Node_Str",Float.POSITIVE_INFINITY);
              minBounds.set("String_Node_Str",Float.POSITIVE_INFINITY);
              minBounds.set("String_Node_Str",Float.POSITIVE_INFINITY);
              maxBounds.set("String_Node_Str",-Float.NEGATIVE_INFINITY);
              maxBounds.set("String_Node_Str",-Float.NEGATIVE_INFINITY);
              maxBounds.set("String_Node_Str",-Float.NEGATIVE_INFINITY);
              geometryInfo.setAttribute(GeometryPackage.eINSTANCE.getGeometryInfo_MinBounds(),minBounds);
              geometryInfo.setAttribute(GeometryPackage.eINSTANCE.getGeometryInfo_MaxBounds(),maxBounds);
              VirtualObject geometryData=new HashMapVirtualObject(queryContext,GeometryPackage.eINSTANCE.getGeometryData());
              geometryData.setAttribute(GeometryPackage.eINSTANCE.getGeometryData_Indices(),intArrayToByteArray(geometry.getIndices()));
              geometryData.setAttribute(GeometryPackage.eINSTANCE.getGeometryData_Vertices(),floatArrayToByteArray(geometry.getVertices()));
              geometryData.setAttribute(GeometryPackage.eINSTANCE.getGeometryData_MaterialIndices(),intArrayToByteArray(geometry.getMaterialIndices()));
              geometryData.setAttribute(GeometryPackage.eINSTANCE.getGeometryData_Normals(),floatArrayToByteArray(geometry.getNormals()));
              geometryInfo.setAttribute(GeometryPackage.eINSTANCE.getGeometryInfo_PrimitiveCount(),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.setAttribute(GeometryPackage.eINSTANCE.getGeometryData_Materials(),floatArrayToByteArray(vertex_colors));
                }
              }
              double[] tranformationMatrix=new double[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,generateGeometryResult);
              }
              geometryInfo.setReference(GeometryPackage.eINSTANCE.getGeometryInfo_Data(),geometryData.getOid(),0);
              long size=getSize(geometryData);
              setTransformationMatrix(geometryInfo,tranformationMatrix);
              if (bimServer.getServerSettingsCache().getServerSettings().isReuseGeometry()) {
                int hash=hash(geometryData);
                if (hashes.containsKey(hash)) {
                  geometryInfo.setReference(GeometryPackage.eINSTANCE.getGeometryInfo_Data(),hashes.get(hash).getOid(),0);
                  bytesSaved.addAndGet(size);
                }
 else {
                  hashes.put(hash,geometryData);
                  geometryData.save();
                }
              }
 else {
                geometryData.save();
              }
              geometryInfo.save();
              totalBytes.addAndGet(size);
              ifcProduct.setReference(geometryFeature,geometryInfo.getOid(),0);
              ifcProduct.saveOverwrite();
            }
          }
 catch (          EntityNotFoundException e) {
            boolean ignoreNotFound=false;
            if (!ignoreNotFound) {
              LOGGER.info("String_Node_Str" + ifcProduct.eClass().getName() + "String_Node_Str"+ (expressId)+ "String_Node_Str"+ ifcProduct.getOid());
            }
          }
catch (          BimserverDatabaseException|RenderEngineException e) {
            LOGGER.error("String_Node_Str",e);
          }
        }
      }
    }
  finally {
      in.close();
      renderEngineModel.close();
      jobsDone.incrementAndGet();
      updateProgress();
    }
  }
 catch (  SerializerException|RenderEngineException|IOException e) {
    LOGGER.error("String_Node_Str",e);
  }
}

Fixed version (ground truth):
@Override public void run(){
  StreamingSerializer ifcSerializer=ifcSerializerPlugin.createSerializer(new PluginConfiguration());
  try (RenderEngine renderEngine=renderEnginePlugin.createRenderEngine(new PluginConfiguration(),queryContext.getPackageMetaData().getSchema().getEPackageName())){
    renderEngine.init();
    final Set<HashMapVirtualObject> oids=new HashSet<>();
    ObjectProviderProxy proxy=new ObjectProviderProxy(objectProvider,new ObjectListener(){
      @Override public void newObject(      HashMapVirtualObject next){
        if (eClass.isSuperTypeOf(next.eClass())) {
          oids.add(next);
        }
      }
    }
);
    ifcSerializer.init(proxy,null,null,bimServer.getPluginManager(),packageMetaData);
    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);
      try {
        renderEngineModel.generateGeneralGeometry();
      }
 catch (      RenderEngineException e) {
        if (e.getCause() instanceof java.io.EOFException) {
          if (oids.isEmpty()) {
          }
 else {
            LOGGER.error("String_Node_Str" + eClass.getName(),e);
          }
        }
      }
      OidConvertingSerializer oidConvertingSerializer=(OidConvertingSerializer)ifcSerializer;
      Map<Long,Integer> oidToEid=oidConvertingSerializer.getOidToEid();
      for (      HashMapVirtualObject ifcProduct : oids) {
        Integer expressId=oidToEid.get(ifcProduct.getOid());
        if (ifcProduct.eGet(representationFeature) != null) {
          try {
            RenderEngineInstance renderEngineInstance=renderEngineModel.getInstanceFromExpressId(expressId);
            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) {
              VirtualObject geometryInfo=new HashMapVirtualObject(queryContext,GeometryPackage.eINSTANCE.getGeometryInfo());
              WrappedVirtualObject minBounds=new HashMapWrappedVirtualObject(queryContext,GeometryPackage.eINSTANCE.getVector3f());
              WrappedVirtualObject maxBounds=new HashMapWrappedVirtualObject(queryContext,GeometryPackage.eINSTANCE.getVector3f());
              minBounds.set("String_Node_Str",Double.POSITIVE_INFINITY);
              minBounds.set("String_Node_Str",Double.POSITIVE_INFINITY);
              minBounds.set("String_Node_Str",Double.POSITIVE_INFINITY);
              maxBounds.set("String_Node_Str",-Double.NEGATIVE_INFINITY);
              maxBounds.set("String_Node_Str",-Double.NEGATIVE_INFINITY);
              maxBounds.set("String_Node_Str",-Double.NEGATIVE_INFINITY);
              geometryInfo.setAttribute(GeometryPackage.eINSTANCE.getGeometryInfo_MinBounds(),minBounds);
              geometryInfo.setAttribute(GeometryPackage.eINSTANCE.getGeometryInfo_MaxBounds(),maxBounds);
              VirtualObject geometryData=new HashMapVirtualObject(queryContext,GeometryPackage.eINSTANCE.getGeometryData());
              geometryData.setAttribute(GeometryPackage.eINSTANCE.getGeometryData_Indices(),intArrayToByteArray(geometry.getIndices()));
              geometryData.setAttribute(GeometryPackage.eINSTANCE.getGeometryData_Vertices(),floatArrayToByteArray(geometry.getVertices()));
              geometryData.setAttribute(GeometryPackage.eINSTANCE.getGeometryData_MaterialIndices(),intArrayToByteArray(geometry.getMaterialIndices()));
              geometryData.setAttribute(GeometryPackage.eINSTANCE.getGeometryData_Normals(),floatArrayToByteArray(geometry.getNormals()));
              geometryInfo.setAttribute(GeometryPackage.eINSTANCE.getGeometryInfo_PrimitiveCount(),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.setAttribute(GeometryPackage.eINSTANCE.getGeometryData_Materials(),floatArrayToByteArray(vertex_colors));
                }
              }
              double[] tranformationMatrix=new double[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,generateGeometryResult);
              }
              geometryInfo.setReference(GeometryPackage.eINSTANCE.getGeometryInfo_Data(),geometryData.getOid(),0);
              long size=getSize(geometryData);
              setTransformationMatrix(geometryInfo,tranformationMatrix);
              if (bimServer.getServerSettingsCache().getServerSettings().isReuseGeometry()) {
                int hash=hash(geometryData);
                if (hashes.containsKey(hash)) {
                  geometryInfo.setReference(GeometryPackage.eINSTANCE.getGeometryInfo_Data(),hashes.get(hash).getOid(),0);
                  bytesSaved.addAndGet(size);
                }
 else {
                  hashes.put(hash,geometryData);
                  geometryData.save();
                }
              }
 else {
                geometryData.save();
              }
              geometryInfo.save();
              totalBytes.addAndGet(size);
              ifcProduct.setReference(geometryFeature,geometryInfo.getOid(),0);
              ifcProduct.saveOverwrite();
            }
          }
 catch (          EntityNotFoundException e) {
            boolean ignoreNotFound=false;
            if (!ignoreNotFound) {
              LOGGER.info("String_Node_Str" + ifcProduct.eClass().getName() + "String_Node_Str"+ (expressId)+ "String_Node_Str"+ ifcProduct.getOid());
            }
          }
catch (          BimserverDatabaseException|RenderEngineException e) {
            LOGGER.error("String_Node_Str",e);
          }
        }
      }
    }
  finally {
      in.close();
      renderEngineModel.close();
      jobsDone.incrementAndGet();
      updateProgress();
    }
  }
 catch (  Exception e) {
    LOGGER.error("String_Node_Str",e);
  }
}