BufferedWriter output = null;
try {
output = new BufferedWriter(new FileWriter(path));
output.write(text);
} catch (IOException ex) {
throw new CanNotWriteFileException("Cannot write file \"" + path +
"\"");
} finally {
try {
if (output != null) {
output.close();
}
} catch (IOException ex) {
throw new CanNotWriteFileException("Cannot write file \"" + path +
"\"");
}
}
}