Minor tweaks to BOPConfig.java

This commit is contained in:
Cheeserolls 2015-05-26 16:48:50 +01:00
parent 42da4d197c
commit 1892ce1959
1 changed files with 11 additions and 1 deletions

View File

@ -115,7 +115,7 @@ public class BOPConfig
public void parse(String jsonString) public void parse(String jsonString)
{ {
this.members = new HashMap<String, JsonElement>(); this.members = new HashMap<String, JsonElement>();
if (jsonString != null) {return;} if (jsonString == null) {return;}
JsonElement rootElement = null; JsonElement rootElement = null;
try try
{ {
@ -543,6 +543,11 @@ public class BOPConfig
public static class ConfigFileObj extends ConfigObjBase public static class ConfigFileObj extends ConfigObjBase
{ {
public ConfigFileObj(File configFile) public ConfigFileObj(File configFile)
{
this(configFile, false);
}
public ConfigFileObj(File configFile, boolean warnIfMissing)
{ {
this.prefix = configFile.getAbsolutePath(); this.prefix = configFile.getAbsolutePath();
String jsonString = null; String jsonString = null;
@ -554,6 +559,11 @@ public class BOPConfig
} catch (IOException e) { } catch (IOException e) {
this.addMessage("Error reading config file "+e.getMessage()); this.addMessage("Error reading config file "+e.getMessage());
} }
} else {
if (warnIfMissing)
{
this.addMessage("File missing");
}
} }
this.parse(jsonString); this.parse(jsonString);
} }