[Minor] Don't log writing to document in XmlHelper

This commit is contained in:
Robert von Burg 2018-09-28 13:28:29 +02:00
parent 30536cb11c
commit d46bf18fa2
1 changed files with 50 additions and 55 deletions

View File

@ -51,7 +51,7 @@ public class XmlHelper {
/**
* UNIX_LINE_SEP = "\n" : mostly we want this line separator, instead of the windows version
*/
public static final String UNIX_LINE_SEP = "\n"; //$NON-NLS-1$
private static final String UNIX_LINE_SEP = "\n"; //$NON-NLS-1$
/**
* DEFAULT_ENCODING = "utf-8" : defines the default UTF-8 encoding expected of XML files
@ -175,9 +175,6 @@ public class XmlHelper {
* if something went wrong while creating the XML configuration, or writing the element
*/
public static void writeDocument(Document document, File file, String encoding) throws RuntimeException {
String msg = "Exporting document element {0} to {1}"; //$NON-NLS-1$
msg = MessageFormat.format(msg, document.getNodeName(), file.getAbsolutePath());
XmlHelper.logger.info(msg);
writeDocument(document, new StreamResult(file), encoding);
}
@ -250,7 +247,8 @@ public class XmlHelper {
transformer.setOutputProperty(OutputKeys.INDENT, "yes"); //$NON-NLS-1$
transformer.setOutputProperty(OutputKeys.METHOD, "xml"); //$NON-NLS-1$
transformer.setOutputProperty(OutputKeys.ENCODING, docEncoding);
transformer.setOutputProperty("{http://xml.apache.org/xalan}indent-amount", "2"); //$NON-NLS-1$ //$NON-NLS-2$
transformer
.setOutputProperty("{http://xml.apache.org/xalan}indent-amount", "2"); //$NON-NLS-1$ //$NON-NLS-2$
// transformer.setOutputProperty("{http://xml.apache.org/xalan}line-separator", "\t");
// Transform to file
@ -280,13 +278,10 @@ public class XmlHelper {
DocumentBuilderFactory dbfac = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = dbfac.newDocumentBuilder();
Document document = docBuilder.newDocument();
return document;
return docBuilder.newDocument();
} catch (DOMException e) {
throw new XmlException("Failed to create Document: " + e.getLocalizedMessage(), e); //$NON-NLS-1$
} catch (ParserConfigurationException e) {
} catch (DOMException | ParserConfigurationException e) {
throw new XmlException("Failed to create Document: " + e.getLocalizedMessage(), e); //$NON-NLS-1$
}
}