* Removes all left over backup files, if any, after the synchronization.
* This acts as a safely net. At times, directories can not be removed
* because of file locks. This is another try to remove the stale dirs.
*/
private void removeSaveDirs() {
FilePersistenceStore store = new FilePersistenceStore();
String applicationsSave = null;
try {
// removes the applications_save dir
applicationsSave = (String) store.getBackupFileName(
_applicationsDir.getCanonicalPath());
FileHandler handler =
new FileHandler(new File(applicationsSave), _trash);
handler.remove();
} catch (Exception applicationsEx) {
try {
FileUtils.liquidate( new File(applicationsSave) );
} catch (Exception e) {
_logger.log(Level.FINE,
"Error while removing applications_save dir", e);
}
}
String generatedSave = null;
try {
// removes the generated_save dir
generatedSave = (String) store.getBackupFileName(
_generatedDir.getCanonicalPath());
FileHandler handler =
new FileHandler(new File(generatedSave), _trash);
handler.remove();
} catch (Exception generatedEx) {
try {
FileUtils.liquidate( new File(generatedSave) );
} catch (Exception e) {
_logger.log(Level.FINE,
"Error while removing generated_save dir", e);
}
}
String docrootSave = null;
try {
// removes the docroot_save dir
docrootSave = (String) store.getBackupFileName(
_docrootDir.getCanonicalPath());
FileHandler handler =
new FileHandler(new File(docrootSave), _trash);
handler.remove();
} catch (Exception docrootEx) {
try {
FileUtils.liquidate( new File(docrootSave) );
} catch (Exception e) {
_logger.log(Level.FINE,
"Error while removing docroot_save dir", e);
}
}
String libSave = null;
try {
// removes the lib_save dir
libSave = (String) store.getBackupFileName(
_libDir.getCanonicalPath());
FileHandler handler =
new FileHandler(new File(libSave), _trash);
handler.remove();
} catch (Exception libEx) {
try {
FileUtils.liquidate( new File(libSave) );
} catch (Exception e) {
_logger.log(Level.FINE,
"Error while removing lib_save dir", e);
}
}
String configSave = null;
try {
// removes the config_save dir
configSave = (String) store.getBackupFileName(
_configDir.getCanonicalPath());
FileHandler handler =
new FileHandler(new File(configSave), _trash);
handler.remove();
} catch (Exception configEx) {
try {
FileUtils.liquidate( new File(configSave) );
} catch (Exception e) {
_logger.log(Level.FINE,
"Error while removing config_save dir", e);
}
}
String jwsSave = null;
try {
// removes the java-web-start_save dir
jwsSave = (String) store.getBackupFileName(
_jwsDir.getCanonicalPath());
FileHandler handler =
new FileHandler(new File(jwsSave), _trash);
handler.remove();
} catch (Exception configEx) {