backupConfigFile();
configFile.createNewFile();
fos = new FileOutputStream(configFile);
<BUG>bos = new BufferedOutputStream(fos);
final XMLMapper mapper = XMLMapper.Factory.create();
mapper.deparseDocument(new RootElementWriter(domainModel), XMLOutputFactory.newInstance().createXMLStreamWriter(bos));
fos.close();
} catch (Exception e) {</BUG>
logger.errorf(e, "Failed persisting configuration file %s" , configFile.getAbsolutePath());
<BUG>} finally {
StreamUtils.safeClose(fos);</BUG>
}

backupConfigFile();
configFile.createNewFile();
fos = new FileOutputStream(configFile);
bos = new BufferedOutputStream(fos);
xmlWriter = XMLOutputFactory.newInstance().createXMLStreamWriter(bos);
final XMLMapper mapper = XMLMapper.Factory.create();
mapper.deparseDocument(new RootElementWriter(domainModel), xmlWriter);
xmlWriter.close();
} catch (Exception e) {
logger.errorf(e, "Failed persisting configuration file %s" , configFile.getAbsolutePath());
} finally {
StreamUtils.safeClose(bos);
StreamUtils.safeClose(fos);
