Fixed blank yaml config files throwing a null pointer exception

This commit is contained in:
stevenh 2011-03-11 20:07:49 +00:00
parent d733a32f7c
commit c08b5f3558

View File

@ -115,7 +115,11 @@ public class Configuration extends ConfigurationNode {
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private void read(Object input) throws ConfigurationException { private void read(Object input) throws ConfigurationException {
try { try {
root = (Map<String, Object>)input; if ( null == input ) {
root = new HashMap<String, Object>();
} else {
root = (Map<String, Object>)input;
}
} catch (ClassCastException e) { } catch (ClassCastException e) {
throw new ConfigurationException("Root document must be an key-value structure"); throw new ConfigurationException("Root document must be an key-value structure");
} }