final PropertyMap propertyMap, final PropertyMap referenceMap,
Reader input, final boolean bTest)
throws IOException
{
// multiple pass over input, with each pass interpreting next depth level for unknown keys
Reader reader = new SQLTemplateSubstReader(input)
{
protected Object getValue(String sKey, String sDefault)
{
if (referenceMap.hasValue(sKey)) // valid key
{
Object value = propertyMap.findValue(sKey);
if (value == null) // valid key without value
{
propertyMap.setValue(sKey, sDefault);
}
else if (sDefault != null && !value.equals(sDefault)) // new different default
{
s_logger.warn("Multiple defaults detected for key: " + sKey);
}
}
else if (bTest || !sKey.equals("iftest")) // invalid key, possibly requiring reparsing
{
try
{
setTemplateDefaults(propertyMap, referenceMap, new StringReader(sDefault), bTest);
}
catch (IOException e)
{
ObjUtil.rethrow(e); // wrap the exception to pass it out of this function
}
}
return null;
}
};
try
{
while (reader.read() >= 0); // consume entire input
}
catch (RuntimeException e)
{
if (e.getCause() instanceof IOException)
{