private void generateHtmlReport()

in fxcop-agent/src/jetbrains/buildServer/fxcop/agent/FxCopBuildService.java [85:114]


  private void generateHtmlReport() throws TransformerException, IOException {
    final String fxcopReportXslt = getRunnerParameters().get(FxCopConstants.SETTINGS_REPORT_XSLT);
    if (StringUtil.isEmptyOrSpaces(fxcopReportXslt)) {
      getLogger().message("Skipped html report generation since not requested");
      return;
    }

    final File xsltFile = new File(fxcopReportXslt);
    if (!xsltFile.exists()) {
      getLogger().warning(xsltFile.getAbsolutePath() + " not found => won't generate html report");
      return;
    }

    getLogger().progressMessage("Generating HTML report");

    Source xmlSource = new StreamSource(myXmlReportFile);
    Source xsltSource = new StreamSource(xsltFile);
    final FileOutputStream reportFileStream = new FileOutputStream(myHtmlReportFile);

    try {
      TransformerFactory transformerFactory = TransformerFactory.newInstance();
      Transformer trans = transformerFactory.newTransformer(xsltSource);

      trans.transform(xmlSource, new StreamResult(reportFileStream));
    } finally {
      reportFileStream.close();
    }

    myArtifactsWatcher.addNewArtifactsPath(myOutputDirectory.getPath() + "/*.html" + "=>" + ArtifactsUtil.getInternalArtifactPath(""));
  }