XMLReader.readXMLFileToString no longer throws a Transformer exception.

main
fjc40 8 years ago
parent 61d18f85c5
commit b625b6ab05

@ -87,7 +87,7 @@ public class Event {
this.boatXML = XMLReader.readXMLFileToString(boatsXMLFile, StandardCharsets.UTF_8);
this.regattaXML = XMLReader.readXMLFileToString(regattaXMLFile, StandardCharsets.UTF_8);
} catch (TransformerException | XMLReaderException e) {
} catch (XMLReaderException e) {
throw new EventConstructionException("Could not read XML files.", e);
}

@ -166,10 +166,9 @@ public abstract class XMLReader {
* @param path path of the XML
* @param encoding encoding of the xml
* @return A string containing the contents of the specified file.
* @throws TransformerException Issue with the XML format
* @throws XMLReaderException Thrown if file cannot be read for some reason.
*/
public static String readXMLFileToString(String path, Charset encoding) throws TransformerException, XMLReaderException {
public static String readXMLFileToString(String path, Charset encoding) throws XMLReaderException {
InputStream fileStream = XMLReader.class.getClassLoader().getResourceAsStream(path);
@ -182,7 +181,11 @@ public abstract class XMLReader {
doc.getDocumentElement().normalize();
try {
return XMLReader.getContents(doc);
} catch (TransformerException e) {
throw new XMLReaderException("Could not get XML file contents.", e);
}
}

@ -91,7 +91,7 @@ public class BinaryMessageDecoderTest {
XMLMessageDecoderTest.compareXMLMessages(xmlMessage, xmlMessageDecoded);
} catch (XMLReaderException | TransformerException e){
} catch (XMLReaderException e){
fail("couldn't read file" + e.getMessage());
}
}

@ -53,7 +53,7 @@ public class XMLMessageDecoderTest {
compareXMLMessages(message, decodedMessage);
} catch (XMLReaderException | TransformerException e){
} catch (XMLReaderException e){
fail("couldn't read file" + e.getMessage());
}

@ -38,7 +38,7 @@ public class BoatXMLReaderTest {
try {
boatXMLString = XMLReader.readXMLFileToString("mock/mockXML/boatTest.xml", StandardCharsets.UTF_8);
} catch (TransformerException | XMLReaderException e) {
} catch (XMLReaderException e) {
throw new InvalidBoatDataException("Could not read boat XML file into a string.", e);
}

@ -18,7 +18,7 @@ public class RaceXMLReaderTest {
try {
raceXMLString = XMLReader.readXMLFileToString("mock/mockXML/raceTest.xml", StandardCharsets.UTF_8);
} catch (TransformerException | XMLReaderException e) {
} catch (XMLReaderException e) {
throw new InvalidRaceDataException("Could not read race XML file into a string.", e);
}

@ -27,7 +27,7 @@ public class RegattaXMLReaderTest {
try {
regattaXMLString = XMLReader.readXMLFileToString("mock/mockXML/regattaTest.xml", StandardCharsets.UTF_8);
} catch (TransformerException | XMLReaderException e) {
} catch (XMLReaderException e) {
throw new InvalidRegattaDataException("Could not read regatta XML file into a string.", e);
}

Loading…
Cancel
Save