XMLReader.readXMLFileToString no longer throws a Transformer exception.

This commit is contained in:
fjc40
2017-08-11 22:38:39 +12:00
parent 61d18f85c5
commit b625b6ab05
7 changed files with 12 additions and 9 deletions
@@ -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);
}
}