String contents = "<configuration />";
if ( !writeFile( "user configuration", userConfigFilename, contents ) )
{
if ( !writeFile( "alternative configuration", altConfigFilename, contents ) )
{
throw new RegistryException( "Unable to create configuration file in either user ["
+ userConfigFilename + "] or alternative [" + altConfigFilename
+ "] locations on disk, usually happens when not allowed to write to those locations." );
}
}
try
{
( (Initializable) registry ).initialize();
for ( RegistryListener regListener : registryListeners )
{
addRegistryChangeListener( regListener );
}
}
catch ( InitializationException e )
{
throw new RegistryException( "Unable to reinitialize configuration: " + e.getMessage(), e );
}
triggerEvent( ConfigurationEvent.SAVED );
return registry.getSection( KEY + ".user" );