*/
import org.apache.commons.io.IOUtils;
-import org.apache.commons.lang.StringUtils;
import org.apache.maven.archiva.configuration.io.xpp3.ConfigurationXpp3Reader;
import org.apache.maven.archiva.configuration.io.xpp3.ConfigurationXpp3Writer;
import org.codehaus.plexus.logging.AbstractLogEnabled;
try
{
configuration = reader.read( fileReader, false );
- sanitizeConfiguration( configuration );
+ configuration.sanitize();
}
catch ( IOException e )
{
return configuration;
}
- /**
- * Perform any Upgrades and Adjustments needed to bring configuration up to the
- * current configuration format.
- *
- * @param config the configuration to upgrade and adjust.
- */
- private void sanitizeConfiguration( Configuration config )
- {
- Iterator it = config.getRepositories().iterator();
- while ( it.hasNext() )
- {
- RepositoryConfiguration repo = (RepositoryConfiguration) it.next();
-
- // Ensure that the repo.urlName is set.
- if ( StringUtils.isEmpty( repo.getUrlName() ) )
- {
- repo.setUrlName( repo.getId() );
- }
- }
- }
-
public void storeConfiguration( Configuration configuration )
throws ConfigurationStoreException, InvalidConfigurationException, ConfigurationChangeException
{
return valid;\r
}\r
\r
+ /**\r
+ * Perform any Upgrades and Adjustments needed to bring configuration up to the\r
+ * current configuration format.\r
+ */\r
+ public void sanitize()\r
+ {\r
+ for ( java.util.Iterator i = getRepositories().iterator(); i.hasNext(); )\r
+ {\r
+ RepositoryConfiguration repo = (RepositoryConfiguration) i.next();\r
+\r
+ // Ensure that the repo.urlName is set.\r
+ if ( org.codehaus.plexus.util.StringUtils.isEmpty( repo.getUrlName() ) )\r
+ {\r
+ repo.setUrlName( repo.getId() );\r
+ }\r
+ }\r
+ }\r
+\r
public RepositoryConfiguration getRepositoryByUrlName( String urlName )\r
{\r
for ( java.util.Iterator i = getRepositories().iterator(); i.hasNext(); )\r