Trim content for possible evasion of hidden invalid chars.

This commit is contained in:
Olof Larsson 2013-10-03 00:37:07 +02:00
parent 23ddea0772
commit 17c21a0918
2 changed files with 2 additions and 0 deletions

View File

@ -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))
{

View File

@ -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<JsonElement, Long>(raw, mtime);