diff --git a/CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/reporting/pdf/PdfStreamReporter.java b/CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/reporting/pdf/PdfStreamReporter.java index 65c137acc52ca042b9ad24cb7079258c69cc28ae..f1f5374e7a0060b74c689fcd1806e0ae2f8dc389 100644 --- a/CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/reporting/pdf/PdfStreamReporter.java +++ b/CityDoctorParent/CityDoctorValidation/src/main/java/de/hft/stuttgart/citydoctor2/reporting/pdf/PdfStreamReporter.java @@ -393,21 +393,7 @@ public class PdfStreamReporter implements StreamReporter { @Override public void finishReport() throws CheckReportWriteException { if (buildings != null) { - for (Section s : buildings.getSubSections()) { - if (!s.hasErrors()) { - numOkBuildings++; - // building has no errors, no table - continue; - } - numErrorBuildings++; - Table t = new Table(2); - t.setTableColumnWidth(75, 25); - t.setTitle("Error", "Count"); - for (Entry<String, AtomicInteger> e : s.getStats().getErrorCounts().entrySet()) { - t.addRow(e.getKey(), e.getValue().toString()); - } - s.addTable(1, t); - } + countFinishedReportBuildings(); } int numBuildings = numErrorBuildings + numOkBuildings; if (numBuildings > 0) { @@ -446,6 +432,24 @@ public class PdfStreamReporter implements StreamReporter { report.save(outFile); } + private void countFinishedReportBuildings() { + for (Section s : buildings.getSubSections()) { + if (!s.hasErrors()) { + numOkBuildings++; + // building has no errors, no table + continue; + } + numErrorBuildings++; + Table t = new Table(2); + t.setTableColumnWidth(75, 25); + t.setTitle("Error", "Count"); + for (Entry<String, AtomicInteger> e : s.getStats().getErrorCounts().entrySet()) { + t.addRow(e.getKey(), e.getValue().toString()); + } + s.addTable(1, t); + } + } + @Override public void reportGlobalError(CheckError err) { AtomicInteger errorCount = errorStatistics.computeIfAbsent(err.getErrorId(), k -> new AtomicInteger(0));