diff --git a/Sda1/Etest/SaxMemo2Html/SaxMemo2Hhtml_solution/src/test/java/de/hdm_stuttgart/de/testing/dom/ConversionTest.java b/Sda1/Etest/SaxMemo2Html/SaxMemo2Hhtml_solution/src/test/java/de/hdm_stuttgart/de/testing/dom/ConversionTest.java index bad5fac8917716f87d5b1242a7bc8d5e264db794..bd5c87eb05227b51717168005ac56f1ddf81d53e 100644 --- a/Sda1/Etest/SaxMemo2Html/SaxMemo2Hhtml_solution/src/test/java/de/hdm_stuttgart/de/testing/dom/ConversionTest.java +++ b/Sda1/Etest/SaxMemo2Html/SaxMemo2Hhtml_solution/src/test/java/de/hdm_stuttgart/de/testing/dom/ConversionTest.java @@ -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(); } }