InputStream oResourceStream = null;
Config oConfig;
if ( _sResourceName == null )
{
throw new ConfigLoaderException( "config-load: no resource to load the config specified!" );
}
try
{
oResourceStream = _oResourceLoader.getResourceAsStream( _sResourceName );
if ( oResourceStream == null )
{
throw new ConfigLoaderException( "config-load: error opening: " + _sResourceName );
}
// load the configuration into a new Config object
DigesterFactory.getDigester( oConfig = new Config(), _oResourceLoader ).parse( oResourceStream );
}
catch ( IOException e )
{
throw new ConfigLoaderException( "config-load: I/O error on: " + _sResourceName, e );
}
catch ( SAXException e )
{
throw new ConfigLoaderException( "config-load: XML parse error in: " + _sResourceName, e );
}
finally
{
try
{
if ( oResourceStream != null )
{
oResourceStream.close();
}
}
catch ( IOException e )
{
throw new ConfigLoaderException( "config-load: stream close error on: " + _sResourceName, e );
}
}
return oConfig;
}