private String extensionOf(Report report) { return "." + report.getType(); } }
@Override public void closeReport(Report report) throws IOException { Writer out = null; try { File reportFile = new File(reportsDirectory, outputNameOf(report)); reportFile.getParentFile().mkdirs(); out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(reportFile.getAbsolutePath()), "UTF-8")); report.printTo(out); out.flush(); } finally { IOUtils.closeQuietly(out); } }
report.generate(document); Statistics stats = document.getStatistics(); monitor.testDone(stats.rightCount(), stats.wrongCount(), stats.exceptionCount(), stats.ignoredCount()); LOG.error(LOG_ERROR, e); if (report != null) { report.renderException(e);
private void downloadSpecification(Repository repository, String spec) throws MojoExecutionException { try { FileReportGenerator generator = new FileReportGenerator(new File(specsDirectory, repository.getName())); generator.adjustReportFilesExtensions(true); Document doc = repository.getDocumentRepository().loadDocument(spec); Report report = generator.openReport(spec); report.generate(doc); generator.closeReport(report); countDownload(repository, spec); } catch (Exception e) { throw new MojoExecutionException(format("Error downloading specification document %s from %s", spec, repository .getName()), e); } }
private String outputNameOf(Report report) { String name = report.getName(); StringBuilder nameBuilder = new StringBuilder(name); if (automaticExtension && ! name.endsWith(extensionOf(report))) { nameBuilder.append(extensionOf(report)); } return URIUtil.escapeFileSystemForbiddenCharacters(nameBuilder.toString()); }