From 98c3e5ce8eb7db0ca4087fe371b38b155f26bf57 Mon Sep 17 00:00:00 2001 From: KHobbits Date: Thu, 2 Feb 2012 09:48:56 +0000 Subject: [PATCH] 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)