try {
writer.write(data.toString() + newLine);
writer.flush();
} catch (IOException e) {
logger.error("Cannot write to data collection \"" + dataFile.getName() + "\". Error message is \"IOException: " + e.getLocalizedMessage() + "\"");
throw new CannotWriteDataCollection(dataFile.getName(),"IOException: " + e.getLocalizedMessage());
}
}