Skip to content
Snippets Groups Projects
Commit dd253caf authored by Goik Martin's avatar Goik Martin
Browse files

Abandon test when result is not well-formed

parent c13cecc1
No related branches found
No related tags found
No related merge requests found
......@@ -25,7 +25,7 @@ public abstract class ConversionTest {
public final String xmlInputFileName, htmlOutputFileName;
final ContentRedirect saxHandler;
protected String errorInitString = null;
protected static String errorInitString = null;
protected static Element htmlRootElement = null;
......@@ -56,25 +56,29 @@ public abstract class ConversionTest {
}
try {
memo2html.parse(xmlInputFileName);
} catch (IOException e1) {
} catch (SAXException | IOException e) {
errorInitString = "Unable parse file '" + xmlInputFileName
+ "'";
+ "': " + e.getLocalizedMessage();
return;
} catch (SAXException e) {
e.printStackTrace();
}
}
out.close();
printResultToStdout();
// Now parse the result for further analysis
//
final SAXBuilder parser = new SAXBuilder();
try {
htmlRootElement = parser.build(htmlOutputFileName)
.getRootElement();
} catch (JDOMException | IOException e1) {
System.err.print(
errorInitString = "Unable to parse file '" + htmlOutputFileName
+ "', see stack trace for further information";
e1.printStackTrace();
+ "':\n" + e1.getLocalizedMessage() +
"\n, exiting");
System.exit(1);
}
out.close();
printResultToStdout();
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment