From dfefaf53bdc4ab12fab8951dd8296822dde53f50 Mon Sep 17 00:00:00 2001 From: 502647092 Date: Mon, 12 Sep 2016 02:13:23 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E5=8D=87=E7=BA=A7=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 502647092 --- src/main/java/pw/yumc/YumCore/config/FileConfig.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/main/java/pw/yumc/YumCore/config/FileConfig.java b/src/main/java/pw/yumc/YumCore/config/FileConfig.java index 42ec76b..16f06b4 100644 --- a/src/main/java/pw/yumc/YumCore/config/FileConfig.java +++ b/src/main/java/pw/yumc/YumCore/config/FileConfig.java @@ -300,9 +300,12 @@ public class FileConfig extends AbstractConfig { * @return 是否需要更新 */ public boolean needUpdate(final String newver, final String oldver) { - if (newver == null || oldver == null) { + if (newver == null) { return false; } + if (oldver == null) { + return true; + } final String[] va1 = newver.split("\\.");// 注意此处为正则匹配,不能用"."; final String[] va2 = oldver.split("\\."); int idx = 0; @@ -432,6 +435,7 @@ public class FileConfig extends AbstractConfig { Log.warning(String.format(CONFIG_BACKUP, filename, newCfgName)); } catch (final IOException e) { Log.warning(String.format(CONFIG_BACKUP_ERROR, filename, e.getMessage())); + Log.debug(oldcfg.getConfigName(), e); } } @@ -482,7 +486,7 @@ public class FileConfig extends AbstractConfig { * @return yyyy-MM-dd HH:mm:ss */ protected String getStringDate(String format) { - format = format == null ? format : "yyyy-MM-dd HH:mm:ss"; + format = format == null ? "yyyy-MM-dd HH:mm:ss" : format; final Date currentTime = new Date(); return new SimpleDateFormat(format).format(currentTime); } @@ -508,6 +512,7 @@ public class FileConfig extends AbstractConfig { */ protected FileConfig init(final File file, final boolean check) { Validate.notNull(file, FILE_NOT_BE_NULL); + this.file = file; if (check) { check(file); }