Recover from broken config files, but keep a backup of the old one for purpose of data recovery.

This commit is contained in:
KHobbits 2012-02-02 09:48:56 +00:00
parent 6e2ac3b56e
commit e3f3fe84ea

View File

@ -110,9 +110,10 @@ public class EssentialsConf extends Configuration
super.load();
}
catch (RuntimeException e)
{
LOGGER.log(Level.SEVERE, "File broken: " + configFile.toString());
throw e;
{
File broken = new File(configFile.getAbsolutePath() + ".broken." + System.currentTimeMillis());
configFile.renameTo(broken);
LOGGER.log(Level.SEVERE, "The file " + configFile.toString() + " is broken, it has been renamed to " + broken.toString(), e.getCause());
}
if (this.root == null)