Creation of error reports fails
Creation of error reports fails
Summary
CityDoctor currently fails to create error reports if the citymodel contains top-level CityObject types added in version 3.16.0
Steps to reproduce
-
Open a CityGML file containing newly added CityObject types like e.g. CityFurniture
-
Run checks
-
Open error statistics and activate checkboxes for PDF and XML reports
-
Click the save button
What is the current bug behavior?
An empty, corrupted PDF file is created and creation of XML report fails silently.
What is the expected correct behavior?
PDF and XML reports should be created.
Relevant logs and/or screenshots
Exception in thread "Thread-9" java.lang.IllegalStateException: Unknown City Object found: class de.hft.stuttgart.citydoctor2.datastructure.GenericCityObject
at de.hft.stuttgart.citydoctor2.reporting.pdf.PdfStreamReporter.report(PdfStreamReporter.java:190)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1708)
at java.base/java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:762)
at java.base/java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:276)
at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:1024)
at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
at de.hft.stuttgart.citydoctor2.reporting.pdf.PdfReporter.writeReport(PdfReporter.java:41)
at de.hft.stuttgart.citydoctor2.check.Checker.writePdfReport(Checker.java:163)
at de.hft.stuttgart.citydoctor2.gui.CityDoctorController.writePdfReport(CityDoctorController.java:1049)
at de.hft.stuttgart.citydoctor2.gui.WriteReportDialog.lambda$initWriteButton$9(WriteReportDialog.java:231)
at java.base/java.lang.Thread.run(Thread.java:1583)
Possible cause
The PDF- and XMLStreamReporter have a switch-case in their report(CityObject co) function, which selects the report formatting according to the CityObject's type. Cases for the newly added top-level CityObject types (Tunnel, CityFurniture and GenericCityObjects) are missing, causing the StreamReporters to throw an IllegalStateException when encountering them.