protected void backupFilesystem() throws ApplicationException {
try {
// Backup first install (potentially everything if install and instance
// are in the same dir
File filesBackupDirectory = getFilesInstallBackupDirectory();
FileManager fm = new FileManager();
File root = getInstallation().getRootDirectory();
FileFilter filter = new UpgradeFileFilter(root);
for (String fileName : root.list()) {
File f = new File(root, fileName);
// Replacing a Windows bat file while it is running with a different
// version leads to unpredictable behavior so we make a special case
// here and during the upgrade components step. This file will only
// be backed up at the end of the process if everything went fine.
if (Utils.isWindows() &&
fileName.equals(Installation.WINDOWS_UPGRADE_FILE_NAME)) {
continue;
}
fm.move(f, filesBackupDirectory, filter);
}
if (!instanceAndInstallInSameDir())
{
filesBackupDirectory = getFilesInstanceBackupDirectory();
root = getInstallation().getInstanceDirectory();
filter = new UpgradeFileFilter(root);
for (String fileName : root.list())
{
File f = new File(root, fileName);
// Replacing a Windows bat file while it is running with a different
// version leads to unpredictable behavior so we make a special case
// here and during the upgrade components step. This file will only
// be backed up at the end of the process if everything went fine.
if (Utils.isWindows()
&& fileName.equals(Installation.WINDOWS_UPGRADE_FILE_NAME))
{
continue;
}
fm.move(f, filesBackupDirectory, filter);
}
}
} catch (ApplicationException ae) {
throw ae;
} catch (Exception e) {