Commit 59e8a24d authored by Riegel's avatar Riegel
Browse files

Code cleaning. Ref #69

parent d06f29ab
...@@ -43,7 +43,6 @@ import javax.xml.transform.Source; ...@@ -43,7 +43,6 @@ import javax.xml.transform.Source;
import javax.xml.transform.Transformer; import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerException; import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory; import javax.xml.transform.TransformerFactory;
import javax.xml.transform.URIResolver;
import javax.xml.transform.dom.DOMResult; import javax.xml.transform.dom.DOMResult;
import javax.xml.transform.dom.DOMSource; import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.sax.SAXResult; import javax.xml.transform.sax.SAXResult;
...@@ -131,7 +130,6 @@ public class Checker { ...@@ -131,7 +130,6 @@ public class Checker {
* given or this checker has not validated anything, nothing is done. * given or this checker has not validated anything, nothing is done.
* *
* @param xmlOutput the output file location for the XML report. Can be null. * @param xmlOutput the output file location for the XML report. Can be null.
* @param model the model for which the report is written.
*/ */
public void writeXmlReport(String xmlOutput) { public void writeXmlReport(String xmlOutput) {
if (!model.isValidated() || xmlOutput == null) { if (!model.isValidated() || xmlOutput == null) {
...@@ -437,13 +435,7 @@ public class Checker { ...@@ -437,13 +435,7 @@ public class Checker {
transformerFactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, ""); transformerFactory.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, "");
transformerFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); transformerFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
transformerFactory.setURIResolver(new URIResolver() { transformerFactory.setURIResolver((href, base) -> new StreamSource(Checker.class.getResourceAsStream(href)));
@Override
public Source resolve(String href, String base) throws TransformerException {
return new StreamSource(Checker.class.getResourceAsStream(href));
}
});
Source dsdlXslSource = new StreamSource(Checker.class.getResourceAsStream("iso_dsdl_include.xsl")); Source dsdlXslSource = new StreamSource(Checker.class.getResourceAsStream("iso_dsdl_include.xsl"));
Transformer dsdlXslTransformer = transformerFactory.newTransformer(dsdlXslSource); Transformer dsdlXslTransformer = transformerFactory.newTransformer(dsdlXslSource);
......
...@@ -27,6 +27,7 @@ import de.hft.stuttgart.citydoctor2.datastructure.CityObject; ...@@ -27,6 +27,7 @@ import de.hft.stuttgart.citydoctor2.datastructure.CityObject;
* @author Matthias Betz * @author Matthias Betz
* *
*/ */
@FunctionalInterface
public interface Filter { public interface Filter {
/** /**
......
...@@ -92,7 +92,7 @@ public class StreamCityGmlConsumer implements CityGmlConsumer { ...@@ -92,7 +92,7 @@ public class StreamCityGmlConsumer implements CityGmlConsumer {
gmlFactory = GeometryFactory.newInstance(); gmlFactory = GeometryFactory.newInstance();
val = new Validation(); val = new Validation();
val.setId("CD" + UUID.randomUUID().toString()); val.setId("CD" + UUID.randomUUID());
val.setValidationDate(ZonedDateTime.now()); val.setValidationDate(ZonedDateTime.now());
val.setValidationSoftware("CityDoctor " + Localization.getText(Localization.VERSION)); val.setValidationSoftware("CityDoctor " + Localization.getText(Localization.VERSION));
statistics = new Statistics(); statistics = new Statistics();
...@@ -182,7 +182,7 @@ public class StreamCityGmlConsumer implements CityGmlConsumer { ...@@ -182,7 +182,7 @@ public class StreamCityGmlConsumer implements CityGmlConsumer {
} }
val.setStatistics(new StatisticsProperty(statistics)); val.setStatistics(new StatisticsProperty(statistics));
ValidationPlan validationPlan = c.createValidationPlan(); ValidationPlan validationPlan = c.createValidationPlan();
validationPlan.setId("CD_PLAN_" + UUID.randomUUID().toString()); validationPlan.setId("CD_PLAN_" + UUID.randomUUID());
cm.getFeatureMembers().add(new AbstractFeatureProperty(validationPlan)); cm.getFeatureMembers().add(new AbstractFeatureProperty(validationPlan));
val.setValidationPlan(new Reference(validationPlan)); val.setValidationPlan(new Reference(validationPlan));
......
...@@ -38,7 +38,7 @@ import de.hft.stuttgart.citydoctor2.check.RequirementType; ...@@ -38,7 +38,7 @@ import de.hft.stuttgart.citydoctor2.check.RequirementType;
*/ */
public class CheckPrototype { public class CheckPrototype {
private Check c; private final Check c;
public CheckPrototype(Check c) { public CheckPrototype(Check c) {
this.c = c; this.c = c;
......
...@@ -45,8 +45,8 @@ public class SvrlContentHandler implements ContentHandler { ...@@ -45,8 +45,8 @@ public class SvrlContentHandler implements ContentHandler {
private StringBuilder buffer; private StringBuilder buffer;
private Map<String, List<SchematronError>> featureErrors; private final Map<String, List<SchematronError>> featureErrors;
private List<SchematronError> generalErrors; private final List<SchematronError> generalErrors;
public SvrlContentHandler() { public SvrlContentHandler() {
featureErrors = new HashMap<>(); featureErrors = new HashMap<>();
...@@ -65,22 +65,23 @@ public class SvrlContentHandler implements ContentHandler { ...@@ -65,22 +65,23 @@ public class SvrlContentHandler implements ContentHandler {
public void setDocumentLocator(Locator locator) { public void setDocumentLocator(Locator locator) {
// not needed // not needed
} }
@SuppressWarnings("RedundantThrows")
@Override @Override
public void startDocument() throws SAXException { public void startDocument() throws SAXException {
// not needed // not needed
} }
@SuppressWarnings("RedundantThrows")
@Override @Override
public void endDocument() throws SAXException { public void endDocument() throws SAXException {
// not needed // not needed
} }
@SuppressWarnings("RedundantThrows")
@Override @Override
public void startPrefixMapping(String prefix, String uri) throws SAXException { public void startPrefixMapping(String prefix, String uri) throws SAXException {
// not needed // not needed
} }
@SuppressWarnings("RedundantThrows")
@Override @Override
public void endPrefixMapping(String prefix) throws SAXException { public void endPrefixMapping(String prefix) throws SAXException {
// not needed // not needed
...@@ -132,17 +133,17 @@ public class SvrlContentHandler implements ContentHandler { ...@@ -132,17 +133,17 @@ public class SvrlContentHandler implements ContentHandler {
buffer.append(ch, start, length); buffer.append(ch, start, length);
} }
} }
@SuppressWarnings("RedundantThrows")
@Override @Override
public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException { public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException {
// not needed // not needed
} }
@SuppressWarnings("RedundantThrows")
@Override @Override
public void processingInstruction(String target, String data) throws SAXException { public void processingInstruction(String target, String data) throws SAXException {
// not needed // not needed
} }
@SuppressWarnings("RedundantThrows")
@Override @Override
public void skippedEntity(String name) throws SAXException { public void skippedEntity(String name) throws SAXException {
// not needed // not needed
......
...@@ -26,6 +26,7 @@ import de.hft.stuttgart.citydoctor2.datastructure.CityObject; ...@@ -26,6 +26,7 @@ import de.hft.stuttgart.citydoctor2.datastructure.CityObject;
* @author Matthias Betz * @author Matthias Betz
* *
*/ */
@FunctionalInterface
public interface FeatureCheckedListener { public interface FeatureCheckedListener {
public void featureChecked(CityObject co); public void featureChecked(CityObject co);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment