}
// log but proceed with no backup
log.warn("Failed to create app backup but proceeding with redeploy of " + appFile.getPath() + ": " + e);
}
FileContentDelegate contentDelegate = new FileContentDelegate(appFile.getParentFile());
try {
// Write the new bits for the application. If successful Tomcat will pick it up and complete the deploy.
contentDelegate.createContent(appFile, tempFile, isExploded);
} catch (Exception e) {
// Deploy failed - rollback to the original app file...
String errorMessage = ThrowableUtil.getAllMessages(e);
try {
FileUtils.purge(appFile, true);
contentDelegate.createContent(appFile, backupFile, isExploded);
errorMessage += " ***** ROLLED BACK TO ORIGINAL APPLICATION FILE. *****";
} catch (Exception e1) {
errorMessage += " ***** FAILED TO ROLLBACK TO ORIGINAL APPLICATION FILE. *****: "
+ ThrowableUtil.getAllMessages(e1);
}