* @throws IOException if an error occurs when writing the XML file
*/
private static void generateXML(AccessDatabase access,
String arg, String stmt, String time, String xsl)
throws IOException {
CreateXMLFile xmlFile = new CreateXMLFile(access);
final String fileName = arg.toUpperCase().endsWith(".XML")
? arg : (arg + ".xml");
Writer out;
try {
out = AccessController.doPrivileged(
new PrivilegedExceptionAction<Writer>() {
@Override
public Writer run() throws IOException {
return new OutputStreamWriter(
new FileOutputStream(fileName), "UTF-8");
}
});
} catch (PrivilegedActionException pae) {
throw (IOException) pae.getCause();
}
try {
xmlFile.writeTheXMLFile(stmt, time, out, xsl);
} finally {
out.close();
}
}