ComponentConfigurator componentConfigurator = null;
try {
componentConfigurator = (ComponentConfigurator) container.lookup(ComponentConfigurator.ROLE);
componentConfigurator.configureComponent(wagon, plexusConf, container.getContainerRealm());
} catch (final ComponentLookupException e) {
throw new WagonConfigurationException(repositoryId, "Unable to lookup wagon configurator."
+ " Wagon configuration cannot be applied.", e);
} catch (ComponentConfigurationException e) {
throw new WagonConfigurationException(repositoryId, "Unable to apply wagon configuration.",
e);
} finally {
if (componentConfigurator != null) {
try {
container.release(componentConfigurator);