Program: 160529
Project: 160529
Buggy source:
public void newRevision(BimServerClientInterface bimServerClientInterface,long poid,long roid,String userToken,long soid,SObjectType settings) throws ServerException, UserException {
  Bcf bcf=new Bcf();
  SSerializerPluginConfiguration sSerializer;
  try {
    sSerializer=bimServerClientInterface.getPluginInterface().getSerializerByPluginClassName("String_Node_Str");
    long download=bimServerClientInterface.getBimsie1ServiceInterface().download(roid,sSerializer.getOid(),true,true);
    SDownloadResult downloadData=bimServerClientInterface.getBimsie1ServiceInterface().getDownloadData(download);
    try {
      ByteArrayOutputStream baos=new ByteArrayOutputStream();
      ((EmfSerializerDataSource)downloadData.getFile().getDataSource()).getSerializer().writeToOutputStream(baos);
      Deserializer deserializer=getPluginManager().requireDeserializer("String_Node_Str").createDeserializer(new PluginConfiguration());
      deserializer.init(getPluginManager().requireSchemaDefinition());
      IfcModelInterface model=deserializer.read(new ByteArrayInputStream(baos.toByteArray()),"String_Node_Str",baos.size());
      List<IfcProject> ifcProjects=model.getAll(IfcProject.class);
      IfcProject mainIfcProject=null;
      if (!ifcProjects.isEmpty()) {
        mainIfcProject=ifcProjects.get(0);
      }
      RenderEngine renderEngine=getPluginManager().requireRenderEngine().createRenderEngine(new PluginConfiguration());
      renderEngine.init();
      RenderEngineModel renderEngineModel=renderEngine.openModel(new ByteArrayInputStream(baos.toByteArray()),baos.size());
      Set<RenderEngineClash> clashes=renderEngineModel.findClashesWithEids(pluginConfiguration.getDouble("String_Node_Str"));
      RenderEngineGeometry geometry=renderEngineModel.finalizeModelling(renderEngineModel.initializeModelling());
      StillImageRenderer stillImageRenderer=getPluginManager().getFirstStillImageRenderPlugin().create(new PluginConfiguration());
      boolean renderImage=true;
      try {
        stillImageRenderer.init(model);
      }
 catch (      StillImageRendererException e) {
        renderImage=false;
      }
      for (      RenderEngineClash clash : clashes) {
        RenderEngineInstanceVisualisationProperties vp=renderEngineModel.getInstanceFromExpressId((int)clash.getEid1()).getVisualisationProperties();
        float x=geometry.getVertex(geometry.getIndex(vp.getStartIndex()));
        float y=geometry.getVertex(geometry.getIndex(vp.getStartIndex()));
        float z=geometry.getVertex(geometry.getIndex(vp.getStartIndex()));
        String guid1=((IfcRoot)model.get(clash.getEid1())).getGlobalId();
        String guid2=((IfcRoot)model.get(clash.getEid2())).getGlobalId();
        UUID topicUuid=UUID.randomUUID();
        Issue issue=new Issue(topicUuid);
        Markup markup=new Markup();
        Header header=new Header();
        File file=new File();
        file.setIfcProject(mainIfcProject.getGlobalId());
        file.setDate(DatatypeFactory.newInstance().newXMLGregorianCalendar(new GregorianCalendar()));
        file.setFilename("String_Node_Str");
        header.getFile().add(file);
        markup.setHeader(header);
        Topic topic=new Topic();
        topic.setGuid(topicUuid.toString());
        topic.setTitle("String_Node_Str");
        markup.setTopic(topic);
        VisualizationInfo visualizationInfo=new VisualizationInfo();
        Component component1=new Component();
        component1.setIfcGuid(guid1);
        component1.setOriginatingSystem("String_Node_Str");
        component1.setAuthoringToolId("String_Node_Str" + clash.getEid1());
        Component component2=new Component();
        component2.setIfcGuid(guid2);
        component2.setOriginatingSystem("String_Node_Str");
        component2.setAuthoringToolId("String_Node_Str" + clash.getEid2());
        VisualizationInfo.Components components=new VisualizationInfo.Components();
        visualizationInfo.setComponents(components);
        components.getComponent().add(component1);
        components.getComponent().add(component2);
        PerspectiveCamera perspectiveCamera=new PerspectiveCamera();
        perspectiveCamera.setFieldOfView(45.0);
        perspectiveCamera.setCameraUpVector(newDirection(0,0,1));
        perspectiveCamera.setCameraViewPoint(newPoint(x - 100,y,z));
        perspectiveCamera.setCameraDirection(newDirection(x,y,z));
        visualizationInfo.setPerspectiveCamera(perspectiveCamera);
        visualizationInfo.setLines(new VisualizationInfo.Lines());
        visualizationInfo.setClippingPlanes(new VisualizationInfo.ClippingPlanes());
        if (renderImage) {
          byte[] snapshot=stillImageRenderer.snapshot(new Vector3f(x - 100,y,z),new Vector3f(0,0,1),new Vector3f(x,y,z),500,500,null);
          issue.setImageData(snapshot);
        }
 else {
          ByteArrayOutputStream baos2=new ByteArrayOutputStream();
          ImageIO.write(new BufferedImage(100,100,BufferedImage.TYPE_INT_ARGB),"String_Node_Str",baos2);
          issue.setImageData(baos2.toByteArray());
        }
        issue.setMarkup(markup);
        issue.setVisualizationInfo(visualizationInfo);
        bcf.addIssue(issue);
      }
    }
 catch (    Exception e) {
      LOGGER.error("String_Node_Str",e);
    }
    SExtendedDataSchema extendedDataSchemaByNamespace=bimServerClientInterface.getBimsie1ServiceInterface().getExtendedDataSchemaByNamespace("String_Node_Str");
    SFile file=new SFile();
    SExtendedData extendedData=new SExtendedData();
    extendedData.setTitle("String_Node_Str");
    file.setFilename("String_Node_Str");
    extendedData.setSchemaId(extendedDataSchemaByNamespace.getOid());
    try {
      byte[] bytes=bcf.toBytes();
      file.setData(bytes);
      file.setMime("String_Node_Str");
      long fileId=bimServerClientInterface.getServiceInterface().uploadFile(file);
      extendedData.setFileId(fileId);
      bimServerClientInterface.getBimsie1ServiceInterface().addExtendedDataToRevision(roid,extendedData);
    }
 catch (    Exception e) {
      LOGGER.error("String_Node_Str",e);
    }
  }
 catch (  PublicInterfaceNotFoundException e) {
    LOGGER.error("String_Node_Str",e);
  }
}

Fixed version (ground truth):
public void newRevision(BimServerClientInterface bimServerClientInterface,long poid,long roid,String userToken,long soid,SObjectType settings) throws ServerException, UserException {
  Bcf bcf=new Bcf();
  SSerializerPluginConfiguration sSerializer;
  try {
    sSerializer=bimServerClientInterface.getPluginInterface().getSerializerByPluginClassName("String_Node_Str");
    long download=bimServerClientInterface.getBimsie1ServiceInterface().download(roid,sSerializer.getOid(),true,true);
    SDownloadResult downloadData=bimServerClientInterface.getBimsie1ServiceInterface().getDownloadData(download);
    try {
      ByteArrayOutputStream baos=new ByteArrayOutputStream();
      DataSource dataSource=downloadData.getFile().getDataSource();
      if (dataSource instanceof ByteArrayDataSource) {
        org.apache.commons.io.IOUtils.copy(((ByteArrayDataSource)dataSource).getInputStream(),baos);
      }
 else {
        ((EmfSerializerDataSource)dataSource).getSerializer().writeToOutputStream(baos);
      }
      Deserializer deserializer=getPluginManager().requireDeserializer("String_Node_Str").createDeserializer(new PluginConfiguration());
      deserializer.init(getPluginManager().requireSchemaDefinition());
      IfcModelInterface model=deserializer.read(new ByteArrayInputStream(baos.toByteArray()),"String_Node_Str",baos.size());
      List<IfcProject> ifcProjects=model.getAll(IfcProject.class);
      IfcProject mainIfcProject=null;
      if (!ifcProjects.isEmpty()) {
        mainIfcProject=ifcProjects.get(0);
      }
      RenderEngine renderEngine=getPluginManager().requireRenderEngine().createRenderEngine(new PluginConfiguration());
      renderEngine.init();
      RenderEngineModel renderEngineModel=renderEngine.openModel(new ByteArrayInputStream(baos.toByteArray()),baos.size());
      Set<RenderEngineClash> clashes=renderEngineModel.findClashesWithEids(pluginConfiguration.getDouble("String_Node_Str"));
      RenderEngineGeometry geometry=renderEngineModel.finalizeModelling(renderEngineModel.initializeModelling());
      StillImageRenderer stillImageRenderer=getPluginManager().getFirstStillImageRenderPlugin().create(new PluginConfiguration());
      boolean renderImage=true;
      try {
        stillImageRenderer.init(model);
      }
 catch (      StillImageRendererException e) {
        renderImage=false;
      }
      for (      RenderEngineClash clash : clashes) {
        RenderEngineInstanceVisualisationProperties vp=renderEngineModel.getInstanceFromExpressId((int)clash.getEid1()).getVisualisationProperties();
        float x=geometry.getVertex(geometry.getIndex(vp.getStartIndex()));
        float y=geometry.getVertex(geometry.getIndex(vp.getStartIndex()));
        float z=geometry.getVertex(geometry.getIndex(vp.getStartIndex()));
        String guid1=((IfcRoot)model.get(clash.getEid1())).getGlobalId();
        String guid2=((IfcRoot)model.get(clash.getEid2())).getGlobalId();
        UUID topicUuid=UUID.randomUUID();
        Issue issue=new Issue(topicUuid);
        Markup markup=new Markup();
        Header header=new Header();
        File file=new File();
        file.setIfcProject(mainIfcProject.getGlobalId());
        file.setDate(DatatypeFactory.newInstance().newXMLGregorianCalendar(new GregorianCalendar()));
        file.setFilename("String_Node_Str");
        header.getFile().add(file);
        markup.setHeader(header);
        Topic topic=new Topic();
        topic.setGuid(topicUuid.toString());
        topic.setTitle("String_Node_Str");
        markup.setTopic(topic);
        VisualizationInfo visualizationInfo=new VisualizationInfo();
        Component component1=new Component();
        component1.setIfcGuid(guid1);
        component1.setOriginatingSystem("String_Node_Str");
        component1.setAuthoringToolId("String_Node_Str" + clash.getEid1());
        Component component2=new Component();
        component2.setIfcGuid(guid2);
        component2.setOriginatingSystem("String_Node_Str");
        component2.setAuthoringToolId("String_Node_Str" + clash.getEid2());
        VisualizationInfo.Components components=new VisualizationInfo.Components();
        visualizationInfo.setComponents(components);
        components.getComponent().add(component1);
        components.getComponent().add(component2);
        PerspectiveCamera perspectiveCamera=new PerspectiveCamera();
        perspectiveCamera.setFieldOfView(45.0);
        perspectiveCamera.setCameraUpVector(newDirection(0,0,1));
        perspectiveCamera.setCameraViewPoint(newPoint(x - 100,y,z));
        perspectiveCamera.setCameraDirection(newDirection(x,y,z));
        visualizationInfo.setPerspectiveCamera(perspectiveCamera);
        visualizationInfo.setLines(new VisualizationInfo.Lines());
        visualizationInfo.setClippingPlanes(new VisualizationInfo.ClippingPlanes());
        if (renderImage) {
          byte[] snapshot=stillImageRenderer.snapshot(new Vector3f(x - 100,y,z),new Vector3f(0,0,1),new Vector3f(x,y,z),500,500,null);
          issue.setImageData(snapshot);
        }
 else {
          ByteArrayOutputStream baos2=new ByteArrayOutputStream();
          ImageIO.write(new BufferedImage(100,100,BufferedImage.TYPE_INT_ARGB),"String_Node_Str",baos2);
          issue.setImageData(baos2.toByteArray());
        }
        issue.setMarkup(markup);
        issue.setVisualizationInfo(visualizationInfo);
        bcf.addIssue(issue);
      }
    }
 catch (    Exception e) {
      LOGGER.error("String_Node_Str",e);
    }
    SExtendedDataSchema extendedDataSchemaByNamespace=bimServerClientInterface.getBimsie1ServiceInterface().getExtendedDataSchemaByNamespace("String_Node_Str");
    SFile file=new SFile();
    SExtendedData extendedData=new SExtendedData();
    extendedData.setTitle("String_Node_Str");
    file.setFilename("String_Node_Str");
    extendedData.setSchemaId(extendedDataSchemaByNamespace.getOid());
    try {
      byte[] bytes=bcf.toBytes();
      file.setData(bytes);
      file.setMime("String_Node_Str");
      long fileId=bimServerClientInterface.getServiceInterface().uploadFile(file);
      extendedData.setFileId(fileId);
      bimServerClientInterface.getBimsie1ServiceInterface().addExtendedDataToRevision(roid,extendedData);
    }
 catch (    Exception e) {
      LOGGER.error("String_Node_Str",e);
    }
  }
 catch (  PublicInterfaceNotFoundException e) {
    LOGGER.error("String_Node_Str",e);
  }
}