if (!(targetDir.endsWith("/") || targetDir.endsWith("\\")))
{
targetDir += "/";
}
ObjectToXml trans = new ObjectToXml();
DefaultMuleException exception = new DefaultMuleException(MessageFactory.createStaticMessage("Some default exception"));
FatalException fatal = new FatalException(MessageFactory.createStaticMessage("Some fatal exception"),
new IOException("Some IO exception"));
BusinessException business = new BusinessException("Some business exception");
ExceptionBean bean = new ExceptionBean(exception);
String xml = (String)trans.transform(bean);
FileUtils.stringToFile(targetDir + "DefaultMuleException.xml", xml);
bean = new ExceptionBean(fatal);
xml = (String)trans.transform(bean);
FileUtils.stringToFile(targetDir + "FatalException.xml", xml);
bean = new ExceptionBean(business);
xml = (String)trans.transform(bean);
FileUtils.stringToFile(targetDir + "BusinesException.xml", xml);
}