From 17c21a0918b0fdd64808bbe0b5ebb8c68f64ce9c Mon Sep 17 00:00:00 2001 From: Olof Larsson Date: Thu, 3 Oct 2013 00:37:07 +0200 Subject: [PATCH] Trim content for possible evasion of hidden invalid chars. --- src/com/massivecraft/mcore/SimpleConfig.java | 1 + src/com/massivecraft/mcore/store/DriverFlatfile.java | 1 + 2 files changed, 2 insertions(+) diff --git a/src/com/massivecraft/mcore/SimpleConfig.java b/src/com/massivecraft/mcore/SimpleConfig.java index cd7c8fcb..72181de4 100644 --- a/src/com/massivecraft/mcore/SimpleConfig.java +++ b/src/com/massivecraft/mcore/SimpleConfig.java @@ -62,6 +62,7 @@ public class SimpleConfig if (this.getFile().isFile()) { String content = DiscUtil.readCatch(this.getFile()); + content = content.trim(); Object toShallowLoad = null; if (contentRequestsDefaults(content)) { diff --git a/src/com/massivecraft/mcore/store/DriverFlatfile.java b/src/com/massivecraft/mcore/store/DriverFlatfile.java index 978bda2c..6ee39098 100644 --- a/src/com/massivecraft/mcore/store/DriverFlatfile.java +++ b/src/com/massivecraft/mcore/store/DriverFlatfile.java @@ -113,6 +113,7 @@ public class DriverFlatfile extends DriverAbstract if (mtime == 0) return null; String content = DiscUtil.readCatch(file); if (content == null) return null; + content = content.trim(); if (content.length() == 0) return null; JsonElement raw = new JsonParser().parse(content); return new SimpleEntry(raw, mtime);