XMLReader.readXMLFileToString no longer throws a Transformer exception.
This commit is contained in:
@@ -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();
|
||||
|
||||
return XMLReader.getContents(doc);
|
||||
try {
|
||||
return XMLReader.getContents(doc);
|
||||
} catch (TransformerException e) {
|
||||
throw new XMLReaderException("Could not get XML file contents.", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user