From e3f3fe84ea9a2e665105f0acc334dbd0fd1c9f8e Mon Sep 17 00:00:00 2001 From: KHobbits Date: Thu, 2 Feb 2012 09:48:56 +0000 Subject: Recover from broken config files, but keep a backup of the old one for purpose of data recovery. --- Essentials/src/com/earth2me/essentials/EssentialsConf.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/EssentialsConf.java b/Essentials/src/com/earth2me/essentials/EssentialsConf.java index 35252532f..ec6e27b53 100644 --- a/Essentials/src/com/earth2me/essentials/EssentialsConf.java +++ b/Essentials/src/com/earth2me/essentials/EssentialsConf.java @@ -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) -- cgit v1.2.3