mirror of
https://github.com/essentials/Essentials.git
synced 2025-02-24 08:22:56 +01:00
[trunk] Throw errors on upgrade rename fail.
git-svn-id: https://svn.java.net/svn/essentials~svn/trunk@1238 e251c2fe-e539-e718-e476-b85c1f46cddb
This commit is contained in:
parent
6918e7561b
commit
7d8a34c3bd
@ -38,7 +38,7 @@ public class EssentialsUpgrade {
|
|||||||
}
|
}
|
||||||
removeLinesFromConfig(configFile,"\\s*#?\\s*worth-[0-9]+.*", "# Worth values have been moved to worth.yml");
|
removeLinesFromConfig(configFile,"\\s*#?\\s*worth-[0-9]+.*", "# Worth values have been moved to worth.yml");
|
||||||
} catch (Throwable e) {
|
} catch (Throwable e) {
|
||||||
logger.log(Level.WARNING, "Error while upgrading the files", e);
|
logger.log(Level.SEVERE, "Error while upgrading the files", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,8 +70,12 @@ public class EssentialsUpgrade {
|
|||||||
br.close();
|
br.close();
|
||||||
bw.close();
|
bw.close();
|
||||||
if (needUpdate) {
|
if (needUpdate) {
|
||||||
file.renameTo(new File(file.getParentFile(), file.getName().concat("."+System.currentTimeMillis()+".upgradebackup")));
|
if (!file.renameTo(new File(file.getParentFile(), file.getName().concat("."+System.currentTimeMillis()+".upgradebackup")))) {
|
||||||
tempFile.renameTo(file);
|
throw new Exception("Failed to move config.yml to backup location.");
|
||||||
|
}
|
||||||
|
if (!tempFile.renameTo(file)) {
|
||||||
|
throw new Exception("Failed to rename temp file to config.yml");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user