]> source.dussan.org Git - archiva.git/commitdiff
clean up some issues and bugs highlighted by inspections
authorBrett Porter <brett@apache.org>
Wed, 28 Jun 2006 05:45:08 +0000 (05:45 +0000)
committerBrett Porter <brett@apache.org>
Wed, 28 Jun 2006 05:45:08 +0000 (05:45 +0000)
git-svn-id: https://svn.apache.org/repos/asf/maven/repository-manager/trunk@417674 13f79535-47bb-0310-9956-ffa450edef68

15 files changed:
maven-repository-converter/src/main/java/org/apache/maven/repository/converter/DefaultRepositoryConverter.java
maven-repository-core/src/main/java/org/apache/maven/repository/DefaultRepositoryManager.java
maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/AbstractArtifactDiscoverer.java
maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/DefaultArtifactDiscoverer.java
maven-repository-discovery/src/main/java/org/apache/maven/repository/discovery/DiscovererPath.java
maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/AbstractRepositoryIndex.java
maven-repository-indexer/src/main/java/org/apache/maven/repository/indexing/RepositoryIndex.java
maven-repository-proxy/src/main/java/org/apache/maven/repository/proxy/configuration/ProxyConfiguration.java
maven-repository-reports-standard/src/main/java/org/apache/maven/repository/reporting/Cache.java
maven-repository-utils/src/main/java/org/apache/maven/repository/digest/DefaultDigester.java
maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/BaseAction.java
maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/IndexConfigurationAction.java
maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/action/SchedulerConfigurationAction.java
maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/execution/DiscovererExecution.java
maven-repository-webapp/src/main/java/org/apache/maven/repository/manager/web/utils/ConfigurationManager.java

index 28d398bee40a47a2c17189cac6e7f344401120aa..f0cc1248c796965a546135a039ff5cbbf3e36e20 100644 (file)
@@ -105,9 +105,7 @@ public class DefaultRepositoryConverter
      */
     private I18N i18n;
 
-    public void convert( Artifact artifact,
-                         ArtifactRepository targetRepository,
-                         ArtifactReporter reporter )
+    public void convert( Artifact artifact, ArtifactRepository targetRepository, ArtifactReporter reporter )
         throws RepositoryConversionException
     {
         if ( artifact.getRepository().getUrl().equals( targetRepository.getUrl() ) )
@@ -165,15 +163,13 @@ public class DefaultRepositoryConverter
         return metadata;
     }
 
-    private void updateMetadata( RepositoryMetadata artifactMetadata,
-                                 ArtifactRepository sourceRepository,
-                                 ArtifactRepository targetRepository,
-                                 Metadata newMetadata,
+    private void updateMetadata( RepositoryMetadata artifactMetadata, ArtifactRepository sourceRepository,
+                                 ArtifactRepository targetRepository, Metadata newMetadata,
                                  FileTransaction transaction )
         throws RepositoryConversionException
     {
         Metadata metadata;
-        boolean changed = false;
+        boolean changed;
 
         //merge with target repository metadata
         File file = new File( targetRepository.getBasedir(),
@@ -198,7 +194,7 @@ public class DefaultRepositoryConverter
             if ( srcfile.exists() )
             {
                 Metadata sourceMetadata = readMetadata( srcfile );
-                changed = changed | metadata.merge( sourceMetadata );
+                changed = changed || metadata.merge( sourceMetadata );
             }
         }
 
@@ -256,8 +252,7 @@ public class DefaultRepositoryConverter
         return metadata;
     }
 
-    private boolean validateMetadata( Artifact artifact,
-                                      ArtifactReporter reporter )
+    private boolean validateMetadata( Artifact artifact, ArtifactReporter reporter )
         throws RepositoryConversionException
     {
         ArtifactRepository repository = artifact.getRepository();
@@ -284,9 +279,7 @@ public class DefaultRepositoryConverter
         return result;
     }
 
-    private boolean validateMetadata( Metadata metadata,
-                                      RepositoryMetadata repositoryMetadata,
-                                      Artifact artifact,
+    private boolean validateMetadata( Metadata metadata, RepositoryMetadata repositoryMetadata, Artifact artifact,
                                       ArtifactReporter reporter )
     {
         String groupIdKey;
@@ -388,9 +381,7 @@ public class DefaultRepositoryConverter
         return result;
     }
 
-    private boolean copyPom( Artifact artifact,
-                             ArtifactRepository targetRepository,
-                             ArtifactReporter reporter,
+    private boolean copyPom( Artifact artifact, ArtifactRepository targetRepository, ArtifactReporter reporter,
                              FileTransaction transaction )
         throws RepositoryConversionException
     {
@@ -505,10 +496,8 @@ public class DefaultRepositoryConverter
         return result;
     }
 
-    private boolean doRelocation( Artifact artifact,
-                                  org.apache.maven.model.v3_0_0.Model v3Model,
-                                  ArtifactRepository repository,
-                                  FileTransaction transaction )
+    private boolean doRelocation( Artifact artifact, org.apache.maven.model.v3_0_0.Model v3Model,
+                                  ArtifactRepository repository, FileTransaction transaction )
         throws IOException
     {
         Properties properties = v3Model.getProperties();
@@ -551,15 +540,9 @@ public class DefaultRepositoryConverter
         }
     }
 
-    private void writeRelocationPom( String groupId,
-                                     String artifactId,
-                                     String version,
-                                     String newGroupId,
-                                     String newArtifactId,
-                                     String newVersion,
-                                     String message,
-                                     ArtifactRepository repository,
-                                     FileTransaction transaction )
+    private void writeRelocationPom( String groupId, String artifactId, String version, String newGroupId,
+                                     String newArtifactId, String newVersion, String message,
+                                     ArtifactRepository repository, FileTransaction transaction )
         throws IOException
     {
         Model pom = new Model();
@@ -592,8 +575,7 @@ public class DefaultRepositoryConverter
         transaction.createFile( strWriter.toString(), pomFile );
     }
 
-    private String getI18NString( String key,
-                                  String arg0 )
+    private String getI18NString( String key, String arg0 )
     {
         return i18n.format( getClass().getName(), Locale.getDefault(), key, arg0 );
     }
@@ -603,26 +585,19 @@ public class DefaultRepositoryConverter
         return i18n.getString( getClass().getName(), Locale.getDefault(), key );
     }
 
-    private boolean testChecksums( Artifact artifact,
-                                   File file,
-                                   ArtifactReporter reporter )
-        throws IOException, RepositoryConversionException
+    private boolean testChecksums( Artifact artifact, File file, ArtifactReporter reporter )
+        throws IOException
     {
-        boolean result;
 
-        result = verifyChecksum( file, file.getName() + ".md5", Digester.MD5, reporter, artifact,
-                                 "failure.incorrect.md5" );
+        boolean result =
+            verifyChecksum( file, file.getName() + ".md5", Digester.MD5, reporter, artifact, "failure.incorrect.md5" );
         result = result && verifyChecksum( file, file.getName() + ".sha1", Digester.SHA1, reporter, artifact,
                                            "failure.incorrect.sha1" );
         return result;
     }
 
-    private boolean verifyChecksum( File file,
-                                    String fileName,
-                                    String algorithm,
-                                    ArtifactReporter reporter,
-                                    Artifact artifact,
-                                    String key )
+    private boolean verifyChecksum( File file, String fileName, String algorithm, ArtifactReporter reporter,
+                                    Artifact artifact, String key )
         throws IOException
     {
         boolean result = true;
@@ -644,9 +619,7 @@ public class DefaultRepositoryConverter
         return result;
     }
 
-    private boolean copyArtifact( Artifact artifact,
-                                  ArtifactRepository targetRepository,
-                                  ArtifactReporter reporter,
+    private boolean copyArtifact( Artifact artifact, ArtifactRepository targetRepository, ArtifactReporter reporter,
                                   FileTransaction transaction )
         throws RepositoryConversionException
     {
@@ -689,9 +662,7 @@ public class DefaultRepositoryConverter
         return result;
     }
 
-    public void convert( List artifacts,
-                         ArtifactRepository targetRepository,
-                         ArtifactReporter reporter )
+    public void convert( List artifacts, ArtifactRepository targetRepository, ArtifactReporter reporter )
         throws RepositoryConversionException
     {
         for ( Iterator i = artifacts.iterator(); i.hasNext(); )
index e63620338119c1c75ffa362a0e0f7ce703e47563..7417189020f871a0086f2a9323c10a2ea2c40188 100644 (file)
@@ -1,16 +1,16 @@
 package org.apache.maven.repository;
 
-import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
-import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
 import org.apache.maven.artifact.repository.ArtifactRepository;
+import org.apache.maven.artifact.repository.ArtifactRepositoryFactory;
+import org.apache.maven.artifact.repository.layout.ArtifactRepositoryLayout;
 import org.apache.maven.repository.converter.RepositoryConversionException;
 import org.apache.maven.repository.converter.RepositoryConverter;
 import org.apache.maven.repository.discovery.ArtifactDiscoverer;
 import org.apache.maven.repository.reporting.ArtifactReporter;
 
 import java.io.File;
-import java.util.List;
 import java.net.MalformedURLException;
+import java.util.List;
 
 /**
  * @author Jason van Zyl
@@ -49,8 +49,7 @@ public class DefaultRepositoryManager
      */
     private ArtifactReporter reporter;
 
-    public void convertLegacyRepository( File legacyRepositoryDirectory,
-                                         File repositoryDirectory,
+    public void convertLegacyRepository( File legacyRepositoryDirectory, File repositoryDirectory,
                                          boolean includeSnapshots )
         throws RepositoryConversionException
     {
index 70f17c9f8aaec09f3423480f1c5872560189221e..0da2fabcef327211a894152fa936b756b797e13a 100644 (file)
@@ -59,9 +59,9 @@ public abstract class AbstractArtifactDiscoverer
     /**
      * Return a list of artifacts found in a specified repository
      *
-     * @param repository The ArtifactRepository to discover artifacts
+     * @param repository          The ArtifactRepository to discover artifacts
      * @param blacklistedPatterns Comma-delimited list of string paths that will be excluded in the discovery
-     * @param includeSnapshots if the repository contains snapshots which should also be included
+     * @param includeSnapshots    if the repository contains snapshots which should also be included
      * @return list of artifacts
      */
     public List discoverArtifacts( ArtifactRepository repository, String blacklistedPatterns, boolean includeSnapshots )
@@ -81,10 +81,9 @@ public abstract class AbstractArtifactDiscoverer
         {
             String path = artifactPaths[i];
 
-            Artifact artifact;
             try
             {
-                artifact = buildArtifactFromPath( path, repository );
+                Artifact artifact = buildArtifactFromPath( path, repository );
 
                 if ( includeSnapshots || !artifact.isSnapshot() )
                 {
@@ -103,9 +102,9 @@ public abstract class AbstractArtifactDiscoverer
     /**
      * Returns a list of pom packaging artifacts found in a specified repository
      *
-     * @param repository The ArtifactRepository to discover artifacts
+     * @param repository          The ArtifactRepository to discover artifacts
      * @param blacklistedPatterns Comma-delimited list of string paths that will be excluded in the discovery
-     * @param includeSnapshots if the repository contains snapshots which should also be included
+     * @param includeSnapshots    if the repository contains snapshots which should also be included
      * @return list of pom artifacts
      */
     public List discoverStandalonePoms( ArtifactRepository repository, String blacklistedPatterns,
@@ -167,7 +166,7 @@ public abstract class AbstractArtifactDiscoverer
     /**
      * Returns an artifact object that is represented by the specified path in a repository
      *
-     * @param path The path that is pointing to an artifact
+     * @param path       The path that is pointing to an artifact
      * @param repository The repository of the artifact
      * @return Artifact
      * @throws DiscovererException when the specified path does correspond to an artifact
index e0fc3c21ecbbf786e7cd680279942305efbe0371..d3b472fbdb048ea25f4e0eddce2a85cd87f1c065 100644 (file)
@@ -49,7 +49,7 @@ public class DefaultArtifactDiscoverer
 
         Collections.reverse( pathParts );
 
-        Artifact artifact = null;
+        Artifact artifact;
         if ( pathParts.size() >= 4 )
         {
             // maven 2.x path
@@ -111,13 +111,13 @@ public class DefaultArtifactDiscoverer
                 Artifact result;
                 if ( classifier == null )
                 {
-                    result = artifactFactory.createArtifact( groupId, artifactId, version, Artifact.SCOPE_RUNTIME,
-                                                             type );
+                    result =
+                        artifactFactory.createArtifact( groupId, artifactId, version, Artifact.SCOPE_RUNTIME, type );
                 }
                 else
                 {
-                    result = artifactFactory.createArtifactWithClassifier( groupId, artifactId, version, type,
-                                                                           classifier );
+                    result =
+                        artifactFactory.createArtifactWithClassifier( groupId, artifactId, version, type, classifier );
                 }
 
                 if ( result.isSnapshot() )
@@ -128,9 +128,8 @@ public class DefaultArtifactDiscoverer
                     {
                         classifier = remainingFilename.substring( classifierIndex + 1 );
                         remainingFilename = remainingFilename.substring( 0, classifierIndex );
-                        result = artifactFactory.createArtifactWithClassifier( groupId, artifactId,
-                                                                               remainingFilename, type,
-                                                                               classifier );
+                        result = artifactFactory.createArtifactWithClassifier( groupId, artifactId, remainingFilename,
+                                                                               type, classifier );
                     }
                     else
                     {
@@ -145,8 +144,8 @@ public class DefaultArtifactDiscoverer
                     }
                     else if ( !result.getBaseVersion().equals( version ) )
                     {
-                        throw new DiscovererException( "Built snapshot artifact base version does not match " +
-                                                       "path version" );
+                        throw new DiscovererException(
+                            "Built snapshot artifact base version does not match " + "path version" );
                     }
                     else
                     {
index 20f621d6f32c8b518e710ae5d3844ac201be4e39..ae2ecee735a53f6c376ea6b99bbeef4a384f48d7 100644 (file)
@@ -21,17 +21,20 @@ package org.apache.maven.repository.discovery;
  */
 public class DiscovererPath
 {
-    private String path;
-    private String comment;
+    /**
+     * The path discovered.
+     */
+    private final String path;
 
-    public DiscovererPath()
-    {
-    }
+    /**
+     * A comment about why the path is being processed.
+     */
+    private final String comment;
 
     public DiscovererPath( String path, String comment )
     {
-        setPath( path );
-        setComment( comment );
+        this.path = path;
+        this.comment = comment;
     }
 
     public String getPath()
@@ -39,18 +42,8 @@ public class DiscovererPath
         return path;
     }
 
-    public void setPath( String path )
-    {
-        this.path = path;
-    }
-
     public String getComment()
     {
         return comment;
     }
-
-    public void setComment( String comment )
-    {
-        this.comment = comment;
-    }
 }
index 30ea608b2b10ea35052c52394f45281edb0fe3fc..2b9af2822a53bda7012466abad2be38b634441f4 100644 (file)
@@ -20,19 +20,19 @@ import org.apache.lucene.analysis.Analyzer;
 import org.apache.lucene.analysis.CharTokenizer;
 import org.apache.lucene.analysis.SimpleAnalyzer;
 import org.apache.lucene.analysis.TokenStream;
+import org.apache.lucene.document.Document;
 import org.apache.lucene.index.IndexReader;
 import org.apache.lucene.index.IndexWriter;
 import org.apache.lucene.index.Term;
-import org.apache.lucene.document.Document;
 import org.apache.maven.artifact.repository.ArtifactRepository;
 
 import java.io.File;
 import java.io.IOException;
 import java.io.Reader;
 import java.util.Collection;
-import java.util.List;
-import java.util.Iterator;
 import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
 import java.util.zip.ZipEntry;
 
 /**
@@ -71,8 +71,7 @@ public abstract class AbstractRepositoryIndex
         }
         catch ( IOException e )
         {
-            throw new RepositoryIndexException( "Failed to validate index path: " +
-                                                getIndexPath().getAbsolutePath(), e );
+            throw new RepositoryIndexException( "Failed to validate index path: " + indexPath.getAbsolutePath(), e );
         }
     }
 
@@ -148,7 +147,7 @@ public abstract class AbstractRepositoryIndex
     /**
      * @see RepositoryIndex#validate()
      */
-    public void validate()
+    public final void validate()
         throws RepositoryIndexException, IOException
     {
         if ( indexExists() )
@@ -201,7 +200,7 @@ public abstract class AbstractRepositoryIndex
     }
 
     /**
-     * @see RepositoryIndex#deleteDocuments(java.util.List) 
+     * @see RepositoryIndex#deleteDocuments(java.util.List)
      */
     public void deleteDocuments( List termList )
         throws RepositoryIndexException, IOException
index 8fb8ff73ef9957dcd3114af476ce5e65d2ff6506..d77c709693e9671287931b9177a22e519195c3e2 100644 (file)
@@ -26,61 +26,62 @@ import java.util.List;
 
 /**
  * @author Edwin Punzalan
+ * @todo can we move all of these constants out of the interface? Perhaps they should be an enumerated type?
  */
 public interface RepositoryIndex
 {
-    static final String POM = "POM";
+    String POM = "POM";
 
-    static final String METADATA = "METADATA";
+    String METADATA = "METADATA";
 
-    static final String ARTIFACT = "ARTIFACT";
+    String ARTIFACT = "ARTIFACT";
 
-    static final String FLD_ID = "id";
+    String FLD_ID = "id";
 
-    static final String FLD_NAME = "name";
+    String FLD_NAME = "name";
 
-    static final String FLD_DOCTYPE = "doctype";
+    String FLD_DOCTYPE = "doctype";
 
-    static final String FLD_GROUPID = "groupId";
+    String FLD_GROUPID = "groupId";
 
-    static final String FLD_ARTIFACTID = "artifactId";
+    String FLD_ARTIFACTID = "artifactId";
 
-    static final String FLD_VERSION = "version";
+    String FLD_VERSION = "version";
 
-    static final String FLD_PACKAGING = "packaging";
+    String FLD_PACKAGING = "packaging";
 
-    static final String FLD_SHA1 = "sha1";
+    String FLD_SHA1 = "sha1";
 
-    static final String FLD_MD5 = "md5";
+    String FLD_MD5 = "md5";
 
-    static final String FLD_LASTUPDATE = "last update";
+    String FLD_LASTUPDATE = "last update";
 
-    static final String FLD_PLUGINPREFIX = "plugin prefix";
+    String FLD_PLUGINPREFIX = "plugin prefix";
 
-    static final String FLD_CLASSES = "class";
+    String FLD_CLASSES = "class";
 
-    static final String FLD_PACKAGES = "package";
+    String FLD_PACKAGES = "package";
 
-    static final String FLD_FILES = "file";
+    String FLD_FILES = "file";
 
-    static final String FLD_LICENSE_URLS = "license url";
+    String FLD_LICENSE_URLS = "license url";
 
-    static final String FLD_DEPENDENCIES = "dependency";
+    String FLD_DEPENDENCIES = "dependency";
 
-    static final String FLD_PLUGINS_BUILD = "build plugin";
+    String FLD_PLUGINS_BUILD = "build plugin";
 
-    static final String FLD_PLUGINS_REPORT = "report plugin";
+    String FLD_PLUGINS_REPORT = "report plugin";
 
-    static final String FLD_PLUGINS_ALL = "plugins_all";
+    String FLD_PLUGINS_ALL = "plugins_all";
 
-    static final String[] FIELDS = {FLD_ID, FLD_NAME, FLD_DOCTYPE, FLD_GROUPID, FLD_ARTIFACTID, FLD_VERSION, FLD_PACKAGING, FLD_SHA1,
+    String[] FIELDS = {FLD_ID, FLD_NAME, FLD_DOCTYPE, FLD_GROUPID, FLD_ARTIFACTID, FLD_VERSION, FLD_PACKAGING, FLD_SHA1,
         FLD_MD5, FLD_LASTUPDATE, FLD_PLUGINPREFIX, FLD_CLASSES, FLD_PACKAGES, FLD_FILES, FLD_LICENSE_URLS,
         FLD_DEPENDENCIES, FLD_PLUGINS_BUILD, FLD_PLUGINS_REPORT, FLD_PLUGINS_ALL};
 
-    static final List KEYWORD_FIELDS = Arrays.asList( new String[]{FLD_ID, FLD_PACKAGING, FLD_LICENSE_URLS, FLD_DEPENDENCIES,
+    List KEYWORD_FIELDS = Arrays.asList( new String[]{FLD_ID, FLD_PACKAGING, FLD_LICENSE_URLS, FLD_DEPENDENCIES,
         FLD_PLUGINS_BUILD, FLD_PLUGINS_REPORT, FLD_PLUGINS_ALL} );
 
-    static final String[] MODEL_FIELDS = {FLD_PACKAGING, FLD_LICENSE_URLS, FLD_DEPENDENCIES, FLD_PLUGINS_BUILD, FLD_PLUGINS_REPORT};
+    String[] MODEL_FIELDS = {FLD_PACKAGING, FLD_LICENSE_URLS, FLD_DEPENDENCIES, FLD_PLUGINS_BUILD, FLD_PLUGINS_REPORT};
 
     ArtifactRepository getRepository();
 
@@ -117,7 +118,7 @@ public interface RepositoryIndex
      *
      * @throws RepositoryIndexException if the given indexPath is not valid for this type of RepositoryIndex
      */
-    public void validate()
+    void validate()
         throws RepositoryIndexException, IOException;
 
     /**
@@ -127,7 +128,7 @@ public interface RepositoryIndex
      * @param docList List of Lucene Documents
      * @throws RepositoryIndexException when an error occurred during the indexing of the documents
      */
-    public void addDocuments( List docList )
+    void addDocuments( List docList )
         throws RepositoryIndexException;
 
     /**
@@ -137,6 +138,6 @@ public interface RepositoryIndex
      * @throws RepositoryIndexException
      * @throws IOException
      */
-    public void deleteDocuments( List termList )
+    void deleteDocuments( List termList )
         throws RepositoryIndexException, IOException;
 }
index b23c895704d333a190b1767621221415ef7da7c8..859c277007959dfdd9c7551c7b97c6428acc90af 100644 (file)
@@ -155,7 +155,7 @@ public class ProxyConfiguration
         validateDirectories();
     }
 
-    private void validateRemoteRepo(  )
+    private void validateRemoteRepo()
         throws ValidationException
     {
         //Verify remote repository set
@@ -169,7 +169,7 @@ public class ProxyConfiguration
     private void validateDirectories()
         throws ValidationException
     {
-        File f = new File( getRepositoryCachePath() );
+        File f = new File( cachePath );
         if ( !f.exists() )
         {
             throw new ValidationException( "Specified directory does not exist: " + f.getAbsolutePath() );
index 1c894d6af6ce281162206220cd728d3bbcc3e3bb..8f695f91d2f1a48d66e62287e04dfda0ca168d1d 100644 (file)
@@ -134,14 +134,12 @@ public class Cache
      */
     public void put( Object key, Object value )
     {
-        Object old = null;
-
         // remove and put: this promotes it to the top since we use a linked hash map
         synchronized ( cache )
         {
             if ( cache.containsKey( key ) )
             {
-                old = cache.remove( key );
+                cache.remove( key );
             }
 
             cache.put( key, value );
index a342227a38d73a601a8dc902e5e58c7c593d0d73..fc69f9045141902f73d21e0cb483d97c5995e558 100644 (file)
@@ -21,9 +21,9 @@ import org.codehaus.plexus.util.StringUtils;
 
 import java.io.File;
 import java.io.FileInputStream;
+import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.InputStream;
-import java.io.FileNotFoundException;
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
 import java.util.regex.Matcher;
@@ -55,7 +55,7 @@ public class DefaultDigester
             throw new DigesterException( "Specified algorithm not found: " + algorithm, e );
         }
 
-        InputStream fis = null;
+        InputStream fis;
         try
         {
             fis = new FileInputStream( file );
@@ -79,7 +79,7 @@ public class DefaultDigester
             }
             while ( numRead != -1 );
         }
-        catch( IOException e )
+        catch ( IOException e )
         {
             throw new DigesterException( "Failed to read from file: " + file.getAbsolutePath(), e );
         }
index 3c64f210cd6f7bd91b2da58affe8b8b9db2baac8..b2c3e031891ea7f9e6589fe20eb736e204310037 100644 (file)
@@ -16,16 +16,16 @@ package org.apache.maven.repository.manager.web.action;
  * limitations under the License.\r
  */\r
 \r
-import com.opensymphony.xwork.ActionSupport;\r
 import com.opensymphony.webwork.interceptor.ParameterAware;\r
+import com.opensymphony.xwork.ActionSupport;\r
 import org.apache.maven.repository.configuration.Configuration;\r
 import org.apache.maven.repository.manager.web.execution.DiscovererExecution;\r
 import org.apache.maven.repository.manager.web.job.DiscovererScheduler;\r
 import org.apache.maven.repository.manager.web.utils.ConfigurationManager;\r
 \r
 import java.io.File;\r
-import java.util.Map;\r
 import java.util.HashMap;\r
+import java.util.Map;\r
 \r
 /**\r
  * This is the Action class of index.jsp, which is the initial page of the web application.\r
@@ -78,9 +78,9 @@ public class BaseAction
             parameters.put( ConfigurationManager.INDEXPATH, config.getIndexPath() );\r
             parameters.put( ConfigurationManager.MIN_INDEXPATH, config.getMinimalIndexPath() );\r
             parameters.put( ConfigurationManager.DISCOVERY_BLACKLIST_PATTERNS, config.getDiscoveryBlackListPatterns() );\r
-            parameters.put( ConfigurationManager.DISCOVER_SNAPSHOTS, new Boolean( config.isDiscoverSnapshots() ) );\r
+            parameters.put( ConfigurationManager.DISCOVER_SNAPSHOTS, Boolean.valueOf( config.isDiscoverSnapshots() ) );\r
             parameters.put( ConfigurationManager.DISCOVERY_CRON_EXPRESSION, config.getDiscoveryCronExpression() );\r
-            setParameters( parameters );\r
+            this.parameters = parameters;\r
 \r
             //Configuration configuration = new Configuration(); // TODO!\r
             execution.executeDiscovererIfIndexDoesNotExist( new File( config.getIndexPath() ) );\r
index 4d7961be8f9a59899d7c26873443e8286604bf2b..d3eb7d4ad009b7acd58ed819d531452381c63eb3 100644 (file)
@@ -1,7 +1,7 @@
 package org.apache.maven.repository.manager.web.action;
 
 /*
- * Copyright 2006 The Apache Software Foundation.
+ * Copyright 2005-2006 The Apache Software Foundation.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -16,13 +16,13 @@ package org.apache.maven.repository.manager.web.action;
  * limitations under the License.
  */
 
-import com.opensymphony.xwork.Action;
 import com.opensymphony.webwork.interceptor.ParameterAware;
+import com.opensymphony.xwork.Action;
+import org.apache.maven.repository.manager.web.utils.ConfigurationManager;
 
-import java.util.Map;
+import java.io.IOException;
 import java.util.HashMap;
-
-import org.apache.maven.repository.manager.web.utils.ConfigurationManager;
+import java.util.Map;
 
 /**
  * @author <a href="mailto:oching@apache.org">Maria Odea Ching</a>
@@ -52,10 +52,10 @@ public class IndexConfigurationAction
      * Method that is executed when the action is invoked.
      *
      * @return a String that specifies where to go to next
-     * @throws Exception
+     * @throws IOException
      */
     public String execute()
-        throws Exception
+        throws IOException
     {
         String[] indexPath = (String[]) parameters.get( ConfigurationManager.INDEXPATH );
         Map map = new HashMap();
index 17db63bafa673f8b4204fed3eb1991313c0bcd24..b81cd02fb9e2c04ba3fe6cd4f6fab2a5abca88d9 100644 (file)
@@ -1,16 +1,30 @@
 package org.apache.maven.repository.manager.web.action;\r
 \r
-import com.opensymphony.xwork.Action;\r
+/*\r
+ * Copyright 2005-2006 The Apache Software Foundation.\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ *      http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
 import com.opensymphony.webwork.interceptor.ParameterAware;\r
+import com.opensymphony.xwork.Action;\r
+import org.apache.maven.repository.manager.web.utils.ConfigurationManager;\r
 \r
-import java.util.Map;\r
 import java.util.HashMap;\r
-\r
-import org.apache.maven.repository.manager.web.utils.ConfigurationManager;\r
+import java.util.Map;\r
 \r
 /**\r
  * @author <a href="mailto:aramirez@apache.org">Allan Ramirez</a>\r
- *\r
  * @plexus.component role="com.opensymphony.xwork.Action" role-hint="org.apache.maven.repository.manager.web.action.SchedulerConfigurationAction"\r
  */\r
 public class SchedulerConfigurationAction\r
@@ -40,14 +54,13 @@ public class SchedulerConfigurationAction
      */\r
     public String execute()\r
     {\r
-        Map map;\r
         try\r
         {\r
-            map = new HashMap();\r
+            Map map = new HashMap();\r
 \r
             String[] cronExpression = (String[]) parameters.get( ConfigurationManager.DISCOVERY_CRON_EXPRESSION );\r
 \r
-            if( cronExpression[0] != null  )\r
+            if ( cronExpression[0] != null )\r
             {\r
                 map.put( ConfigurationManager.DISCOVERY_CRON_EXPRESSION, cronExpression[0] );\r
 \r
@@ -60,8 +73,9 @@ public class SchedulerConfigurationAction
                 return ERROR;\r
             }\r
         }\r
-        catch( Exception e )\r
+        catch ( Exception e )\r
         {\r
+            // TODO: fix error handling!\r
             e.printStackTrace();\r
             return ERROR;\r
         }\r
index c059cd7cb5514022652aa490f7c18c0ac1bf7ee4..f2d6b02792b1c526cac3373c968d03f7ccad332b 100644 (file)
@@ -145,7 +145,7 @@ public class DiscovererExecution
      * @param indexPath    the path to the index file
      */
     protected void indexMetadata( List metadataList, File indexPath, ArtifactRepository repository )
-        throws RepositoryIndexException, MalformedURLException
+        throws RepositoryIndexException
     {
         MetadataRepositoryIndex metadataIndex = indexFactory.createMetadataRepositoryIndex( indexPath, repository );
         metadataIndex.indexMetadata( metadataList );
index 315d3a8826ef4e57624b569a07b2cf8d3e19ae6f..362308bd4c60fda89d607c398556a44d79a2fd19 100644 (file)
@@ -17,17 +17,17 @@ package org.apache.maven.repository.manager.web.utils;
  */
 
 import org.apache.maven.repository.configuration.Configuration;
-import org.apache.maven.repository.configuration.io.xpp3.ConfigurationXpp3Writer;
 import org.apache.maven.repository.configuration.io.xpp3.ConfigurationXpp3Reader;
+import org.apache.maven.repository.configuration.io.xpp3.ConfigurationXpp3Writer;
 import org.codehaus.plexus.util.xml.pull.XmlPullParserException;
 
 import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
 import java.io.FileWriter;
 import java.io.IOException;
-import java.io.Writer;
 import java.io.Reader;
-import java.io.FileReader;
-import java.io.FileNotFoundException;
+import java.io.Writer;
 import java.net.URL;
 import java.util.Iterator;
 import java.util.Map;
@@ -99,7 +99,7 @@ public class ConfigurationManager
             }
             if ( name.equals( DISCOVER_SNAPSHOTS ) )
             {
-                config.setDiscoverSnapshots( Boolean.getBoolean( value ) );
+                config.setDiscoverSnapshots( Boolean.valueOf( value ).booleanValue() );
             }
             if ( name.equals( REPOSITORY_DIRECTORY ) )
             {
@@ -131,7 +131,6 @@ public class ConfigurationManager
     public Configuration getConfiguration()
         throws IOException
     {
-        Map map = null;
         File file = getConfigFile();
         config = new Configuration();
 
@@ -147,6 +146,7 @@ public class ConfigurationManager
             }
             catch ( XmlPullParserException xe )
             {
+                // TODO: fix error handling!
                 xe.printStackTrace();
             }
         }