exportInteraction.reportError("Could not write to file: " + file.getAbsolutePath());
return;
}
try {
XMLWriter xmlWriter = new XMLWriter(fileOutputStream, OutputFormat.createPrettyPrint());
Document document = DocumentHelper.createDocument();
Element rootElement = document.addElement(rootElementTag);
DOM4JSettingsNode settingsNode = new DOM4JSettingsNode(rootElement);
for (int index = 0; index < serializables.length; index++) {
SettingsSerializable serializable = serializables[index];
try { //don't let a single serializer stop the entire thing from being written in.
serializable.serializeOut(settingsNode);
} catch (Exception e) {
LOGGER.error("serializing", e);
}
}
xmlWriter.write(document);
} catch (Throwable t) {
LOGGER.error("Failed to save", t);
exportInteraction.reportError("Internal error. Failed to save.");
} finally {
closeQuietly(fileOutputStream);