use a new Exception registryException is an implementation detail exception
git-svn-id: https://svn.apache.org/repos/asf/archiva/redback/redback-core/trunk@1417398 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6818a0097e
commit
498776efeb
|
@ -66,35 +66,43 @@ public class DefaultUserConfiguration
|
|||
|
||||
@PostConstruct
|
||||
public void initialize()
|
||||
throws RegistryException
|
||||
throws UserConfigurationException
|
||||
{
|
||||
performLegacyInitialization();
|
||||
|
||||
try
|
||||
{
|
||||
registry.addConfigurationFromResource( DEFAULT_CONFIG_RESOURCE, PREFIX );
|
||||
performLegacyInitialization();
|
||||
|
||||
try
|
||||
{
|
||||
registry.addConfigurationFromResource( DEFAULT_CONFIG_RESOURCE, PREFIX );
|
||||
}
|
||||
catch ( RegistryException e )
|
||||
{
|
||||
// Ok, not found in context classloader; try the one in this jar.
|
||||
|
||||
ClassLoader prevCl = Thread.currentThread().getContextClassLoader();
|
||||
try
|
||||
{
|
||||
|
||||
Thread.currentThread().setContextClassLoader( getClass().getClassLoader() );
|
||||
registry.addConfigurationFromResource( DEFAULT_CONFIG_RESOURCE, PREFIX );
|
||||
}
|
||||
finally
|
||||
{
|
||||
Thread.currentThread().setContextClassLoader( prevCl );
|
||||
}
|
||||
}
|
||||
|
||||
lookupRegistry = registry.getSubset( PREFIX );
|
||||
|
||||
log.debug( "User configuration {}", lookupRegistry.dump() );
|
||||
}
|
||||
catch ( RegistryException e )
|
||||
{
|
||||
// Ok, not found in context classloader; try the one in this jar.
|
||||
|
||||
ClassLoader prevCl = Thread.currentThread().getContextClassLoader();
|
||||
try
|
||||
{
|
||||
|
||||
Thread.currentThread().setContextClassLoader( getClass().getClassLoader() );
|
||||
registry.addConfigurationFromResource( DEFAULT_CONFIG_RESOURCE, PREFIX );
|
||||
}
|
||||
finally
|
||||
{
|
||||
Thread.currentThread().setContextClassLoader( prevCl );
|
||||
}
|
||||
throw new UserConfigurationException( e.getMessage(), e );
|
||||
}
|
||||
|
||||
lookupRegistry = registry.getSubset( PREFIX );
|
||||
|
||||
log.debug( "User configuration {}", lookupRegistry.dump() );
|
||||
|
||||
}
|
||||
|
||||
private void performLegacyInitialization()
|
||||
|
|
|
@ -31,7 +31,7 @@ public interface UserConfiguration
|
|||
{
|
||||
|
||||
void initialize()
|
||||
throws RegistryException;
|
||||
throws UserConfigurationException;
|
||||
|
||||
String getString( String key );
|
||||
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
package org.apache.archiva.redback.configuration;
|
||||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @author Olivier Lamy
|
||||
* @since 2.1
|
||||
*/
|
||||
public class UserConfigurationException
|
||||
extends Exception
|
||||
{
|
||||
public UserConfigurationException( String message, Throwable t )
|
||||
{
|
||||
super( message, t );
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue