Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
package org.locationtech.jtstest;

import java.io.File;
import java.nio.file.Files;
import java.util.Iterator;
import java.util.StringTokenizer;

Expand Down Expand Up @@ -49,6 +50,24 @@ public void testDummy()
{

}

public void testExternalGeometryNotIncluded() throws Exception {
File wkt = File.createTempFile("geometry", ".wkt");
File xml = File.createTempFile("testreader", ".xml");
try {
Files.write(wkt.toPath(), "POINT (10 20)".getBytes("UTF-8"));
String run = "<!DOCTYPE run [ <!ENTITY a SYSTEM \"" + wkt.toURI() + "\"> ]>"
+ "<run><case><a>&a;</a><test><op name=\"isValid\" arg1=\"A\">true</op></test></case></run>";
Files.write(xml.toPath(), run.getBytes("UTF-8"));
TestReader testReader = new TestReader();
assertNull(testReader.createTestRun(xml, 0));
assertEquals(1, testReader.getParsingProblems().size());
}
finally {
wkt.delete();
xml.delete();
}
}

public void XtestWktFile() {
TestReader testReader = new TestReader();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ public void clearParsingProblems() {
public TestRun createTestRun(File testFile, int runIndex) {
try {
SAXBuilder builder = new SAXBuilder( );
// test files do not require DOCTYPE
builder.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true);
builder.setJDOMFactory(new LocatedJDOMFactory());
Document document = builder.build(new FileInputStream(testFile));
Element runElement = document.getRootElement();
Expand Down