From: Brett Porter Date: Tue, 17 Mar 2009 16:53:49 +0000 (+0000) Subject: clean up warnings in webapp X-Git-Tag: archiva-1.2~38 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=dddb1c3b45f0400c972d41ee1cef5171708b6847;p=archiva.git clean up warnings in webapp git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@755318 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/archiva-modules/archiva-web/archiva-security/src/main/java/org/apache/maven/archiva/security/ArchivaXworkUser.java b/archiva-modules/archiva-web/archiva-security/src/main/java/org/apache/maven/archiva/security/ArchivaXworkUser.java index 88b3f628e..2cdb7f7f9 100644 --- a/archiva-modules/archiva-web/archiva-security/src/main/java/org/apache/maven/archiva/security/ArchivaXworkUser.java +++ b/archiva-modules/archiva-web/archiva-security/src/main/java/org/apache/maven/archiva/security/ArchivaXworkUser.java @@ -34,7 +34,7 @@ import org.codehaus.plexus.redback.users.UserManager; */ public class ArchivaXworkUser { - public String getActivePrincipal( Map sessionMap ) + public String getActivePrincipal( Map sessionMap ) { SecuritySession securitySession = (SecuritySession) sessionMap.get( SecuritySystemConstants.SECURITY_SESSION_KEY ); diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/BrowseAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/BrowseAction.java index aebfb1527..b185306c1 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/BrowseAction.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/BrowseAction.java @@ -204,6 +204,7 @@ public class BrowseAction } } + @SuppressWarnings("unchecked") private String getPrincipal() { return archivaXworkUser.getActivePrincipal( ActionContext.getContext().getSession() ); diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/DeleteArtifactAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/DeleteArtifactAction.java index ff3b1dde1..e20e0b70a 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/DeleteArtifactAction.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/DeleteArtifactAction.java @@ -213,8 +213,6 @@ public class DeleteArtifactAction TimeZone timezone = TimeZone.getTimeZone( "UTC" ); DateFormat fmt = new SimpleDateFormat( "yyyyMMdd.HHmmss" ); fmt.setTimeZone( timezone ); - String timestamp = fmt.format( lastUpdatedTimestamp ); - ManagedRepositoryConfiguration repoConfig = configuration.getConfiguration().findManagedRepositoryById( repositoryId ); @@ -296,6 +294,7 @@ public class DeleteArtifactAction } } + @SuppressWarnings("unchecked") private String getPrincipal() { return archivaXworkUser.getActivePrincipal( ActionContext.getContext().getSession() ); diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/PlexusActionSupport.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/PlexusActionSupport.java index de6e508c5..025e4f51a 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/PlexusActionSupport.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/PlexusActionSupport.java @@ -34,13 +34,13 @@ public abstract class PlexusActionSupport extends ActionSupport implements SessionAware { - protected Map session; + protected Map session; protected Logger log = LoggerFactory.getLogger( getClass() ); + @SuppressWarnings("unchecked") public void setSession( Map map ) { - //noinspection AssignmentToCollectionOrArrayFieldFromParameter this.session = map; } } diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ShowArtifactAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ShowArtifactAction.java index 9525c7f53..869abd5f7 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ShowArtifactAction.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/ShowArtifactAction.java @@ -28,6 +28,8 @@ import org.apache.maven.archiva.database.ArchivaDatabaseException; import org.apache.maven.archiva.database.ObjectNotFoundException; import org.apache.maven.archiva.database.browsing.RepositoryBrowsing; import org.apache.maven.archiva.model.ArchivaProjectModel; +import org.apache.maven.archiva.model.Dependency; +import org.apache.maven.archiva.model.MailingList; import org.apache.maven.archiva.security.AccessDeniedException; import org.apache.maven.archiva.security.ArchivaSecurityException; import org.apache.maven.archiva.security.PrincipalNotFoundException; @@ -85,16 +87,11 @@ public class ShowArtifactAction /** * The list of artifacts that depend on this versioned project. */ - private List dependees; + private List dependees; - /** - * The reports associated with this versioned project. - */ - private List reports; - - private List mailingLists; + private List mailingLists; - private List dependencies; + private List dependencies; private List snapshotVersions; @@ -168,10 +165,8 @@ public class ShowArtifactAction public String reports() throws ObjectNotFoundException, ArchivaDatabaseException { - System.out.println( "#### In reports." ); // TODO: hook up reports on project - this.reports = artifactsDatabase.findArtifactResults( groupId, artifactId, // version ); - System.out.println( "#### Found " + reports.size() + " reports." ); return SUCCESS; } @@ -200,6 +195,7 @@ public class ShowArtifactAction return SUCCESS; } + @SuppressWarnings("unchecked") private String getPrincipal() { return archivaXworkUser.getActivePrincipal( ActionContext.getContext().getSession() ); @@ -281,22 +277,17 @@ public class ShowArtifactAction this.version = version; } - public List getReports() - { - return reports; - } - - public List getMailingLists() + public List getMailingLists() { return mailingLists; } - public List getDependencies() + public List getDependencies() { return dependencies; } - public List getDependees() + public List getDependees() { return dependees; } diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/UploadAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/UploadAction.java index 9cc6b5a1a..c39850c1a 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/UploadAction.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/UploadAction.java @@ -120,31 +120,11 @@ public class UploadAction */ private File artifactFile; - /** - * The content type of the artifact to be deployed. - */ - private String artifactContentType; - - /** - * The original filename of the uploaded artifact file. - */ - private String artifactFilename; - /** * The temporary file representing the pom to be deployed alongside the artifact. */ private File pomFile; - /** - * The content type of the pom file. - */ - private String pomContentType; - - /** - * The original filename of the uploaded pom file. - */ - private String pomFilename; - /** * The repository where the artifact is to be deployed. */ @@ -191,12 +171,12 @@ public class UploadAction public void setArtifactContentType( String contentType ) { - this.artifactContentType = StringUtils.trim( contentType ); + StringUtils.trim( contentType ); } public void setArtifactFileName( String filename ) { - this.artifactFilename = StringUtils.trim( filename ); + StringUtils.trim( filename ); } public void setPom( File file ) @@ -206,12 +186,12 @@ public class UploadAction public void setPomContentType( String contentType ) { - this.pomContentType = StringUtils.trim( contentType ); + StringUtils.trim( contentType ); } public void setPomFileName( String filename ) { - this.pomFilename = StringUtils.trim( filename ); + StringUtils.trim( filename ); } public String getGroupId() @@ -314,11 +294,7 @@ public class UploadAction packaging = ""; classifier = ""; artifactFile = null; - artifactContentType = ""; - artifactFilename = ""; pomFile = null; - pomContentType = ""; - pomFilename = ""; repositoryId = ""; generatePom = false; } @@ -456,6 +432,7 @@ public class UploadAction } } + @SuppressWarnings("unchecked") private String getPrincipal() { return archivaXworkUser.getActivePrincipal( ActionContext.getContext().getSession() ); diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/SchedulerAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/SchedulerAction.java index fa10c51dd..f3e6f8332 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/SchedulerAction.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/SchedulerAction.java @@ -43,10 +43,6 @@ public class SchedulerAction extends PlexusActionSupport implements SecureAction { - private static final String REPO_SUCCESS = "repoSucces"; - - private static final String DB_SUCCESS = "dbSuccess"; - /** * @plexus.requirement */ diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/AbstractProxyConnectorFormAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/AbstractProxyConnectorFormAction.java index 26a492b65..fddf47e3c 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/AbstractProxyConnectorFormAction.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/AbstractProxyConnectorFormAction.java @@ -19,7 +19,11 @@ package org.apache.maven.archiva.web.action.admin.connectors.proxy; * under the License. */ -import com.opensymphony.xwork2.Preparable; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + import org.apache.commons.lang.StringUtils; import org.apache.maven.archiva.configuration.ProxyConnectorConfiguration; import org.apache.maven.archiva.policies.DownloadErrorPolicy; @@ -27,11 +31,7 @@ import org.apache.maven.archiva.policies.Policy; import org.apache.maven.archiva.policies.PostDownloadPolicy; import org.apache.maven.archiva.policies.PreDownloadPolicy; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; +import com.opensymphony.xwork2.Preparable; /** * AbstractProxyConnectorFormAction - generic fields and methods for either add or edit actions related with the @@ -160,6 +160,7 @@ public abstract class AbstractProxyConnectorFormAction return INPUT; } + @SuppressWarnings("unchecked") public String addProperty() { String key = getPropertyKey(); @@ -419,6 +420,7 @@ public abstract class AbstractProxyConnectorFormAction return new ArrayList( getConfig().getRemoteRepositoriesAsMap().keySet() ); } + @SuppressWarnings("unchecked") protected void validateConnector() { if ( connector.getPolicies() == null ) @@ -440,11 +442,9 @@ public abstract class AbstractProxyConnectorFormAction continue; } - Map properties = connector.getProperties(); - for ( Iterator j = properties.keySet().iterator(); j.hasNext(); ) + Map properties = connector.getProperties(); + for ( String key : properties.keySet() ) { - String key = (String) j.next(); - Object value = properties.get( key ); if ( value.getClass().isArray() ) { diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/database/AddAdminDatabaseConsumerClosure.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/database/AddAdminDatabaseConsumerClosure.java index 64b567732..c625ec1f1 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/database/AddAdminDatabaseConsumerClosure.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/database/AddAdminDatabaseConsumerClosure.java @@ -33,11 +33,11 @@ import java.util.List; public class AddAdminDatabaseConsumerClosure implements Closure { - private List list = new ArrayList(); + private List list = new ArrayList(); - private List selectedIds; + private List selectedIds; - public AddAdminDatabaseConsumerClosure( List selectedIds ) + public AddAdminDatabaseConsumerClosure( List selectedIds ) { this.selectedIds = selectedIds; } @@ -59,7 +59,7 @@ public class AddAdminDatabaseConsumerClosure } } - public List getList() + public List getList() { return list; } diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/database/AdminDatabaseConsumerComparator.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/database/AdminDatabaseConsumerComparator.java index 93ea0abbe..50746c55c 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/database/AdminDatabaseConsumerComparator.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/database/AdminDatabaseConsumerComparator.java @@ -27,7 +27,7 @@ import java.util.Comparator; * @version $Id$ */ public class AdminDatabaseConsumerComparator - implements Comparator + implements Comparator { private static AdminDatabaseConsumerComparator INSTANCE = new AdminDatabaseConsumerComparator(); @@ -36,7 +36,7 @@ public class AdminDatabaseConsumerComparator return INSTANCE; } - public int compare( Object o1, Object o2 ) + public int compare( AdminDatabaseConsumer o1, AdminDatabaseConsumer o2 ) { if ( o1 == null && o2 == null ) { @@ -53,14 +53,8 @@ public class AdminDatabaseConsumerComparator return -1; } - if ( ( o1 instanceof AdminDatabaseConsumer ) && ( o2 instanceof AdminDatabaseConsumer ) ) - { - String id1 = ( (AdminDatabaseConsumer) o1 ).getId(); - String id2 = ( (AdminDatabaseConsumer) o2 ).getId(); - return id1.compareToIgnoreCase( id2 ); - } - - return 0; + String id1 = o1.getId(); + String id2 = o2.getId(); + return id1.compareToIgnoreCase( id2 ); } - } diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/database/DatabaseAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/database/DatabaseAction.java index 0bd57b4f0..d040980ef 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/database/DatabaseAction.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/database/DatabaseAction.java @@ -19,7 +19,9 @@ package org.apache.maven.archiva.web.action.admin.database; * under the License. */ -import com.opensymphony.xwork2.Preparable; +import java.util.Collections; +import java.util.List; + import org.apache.commons.collections.CollectionUtils; import org.apache.maven.archiva.configuration.ArchivaConfiguration; import org.apache.maven.archiva.configuration.Configuration; @@ -27,17 +29,15 @@ import org.apache.maven.archiva.configuration.DatabaseScanningConfiguration; import org.apache.maven.archiva.configuration.IndeterminateConfigurationException; import org.apache.maven.archiva.database.updater.DatabaseConsumers; import org.apache.maven.archiva.security.ArchivaRoleConstants; -import org.apache.maven.archiva.web.action.admin.scanning.AdminRepositoryConsumerComparator; import org.apache.maven.archiva.web.action.PlexusActionSupport; import org.codehaus.plexus.redback.rbac.Resource; import org.codehaus.plexus.registry.RegistryException; - -import java.util.Collections; -import java.util.List; import org.codehaus.redback.integration.interceptor.SecureAction; import org.codehaus.redback.integration.interceptor.SecureActionBundle; import org.codehaus.redback.integration.interceptor.SecureActionException; +import com.opensymphony.xwork2.Preparable; + /** * DatabaseAction * @@ -63,22 +63,22 @@ public class DatabaseAction /** * List of available {@link AdminDatabaseConsumer} objects for unprocessed artifacts. */ - private List unprocessedConsumers; + private List unprocessedConsumers; /** * List of enabled {@link AdminDatabaseConsumer} objects for unprocessed artifacts. */ - private List enabledUnprocessedConsumers; + private List enabledUnprocessedConsumers; /** * List of {@link AdminDatabaseConsumer} objects for "to cleanup" artifacts. */ - private List cleanupConsumers; + private List cleanupConsumers; /** * List of enabled {@link AdminDatabaseConsumer} objects for "to cleanup" artifacts. */ - private List enabledCleanupConsumers; + private List enabledCleanupConsumers; public void prepare() throws Exception @@ -93,12 +93,12 @@ public class DatabaseAction addAdminDbConsumer = new AddAdminDatabaseConsumerClosure( dbscanning.getUnprocessedConsumers() ); CollectionUtils.forAllDo( databaseConsumers.getAvailableUnprocessedConsumers(), addAdminDbConsumer ); this.unprocessedConsumers = addAdminDbConsumer.getList(); - Collections.sort( this.unprocessedConsumers, AdminRepositoryConsumerComparator.getInstance() ); + Collections.sort( this.unprocessedConsumers, AdminDatabaseConsumerComparator.getInstance() ); addAdminDbConsumer = new AddAdminDatabaseConsumerClosure( dbscanning.getCleanupConsumers() ); CollectionUtils.forAllDo( databaseConsumers.getAvailableCleanupConsumers(), addAdminDbConsumer ); this.cleanupConsumers = addAdminDbConsumer.getList(); - Collections.sort( this.cleanupConsumers, AdminRepositoryConsumerComparator.getInstance() ); + Collections.sort( this.cleanupConsumers, AdminDatabaseConsumerComparator.getInstance() ); } public String updateUnprocessedConsumers() @@ -166,32 +166,32 @@ public class DatabaseAction this.cron = cron; } - public List getCleanupConsumers() + public List getCleanupConsumers() { return cleanupConsumers; } - public List getUnprocessedConsumers() + public List getUnprocessedConsumers() { return unprocessedConsumers; } - public List getEnabledUnprocessedConsumers() + public List getEnabledUnprocessedConsumers() { return enabledUnprocessedConsumers; } - public void setEnabledUnprocessedConsumers( List enabledUnprocessedConsumers ) + public void setEnabledUnprocessedConsumers( List enabledUnprocessedConsumers ) { this.enabledUnprocessedConsumers = enabledUnprocessedConsumers; } - public List getEnabledCleanupConsumers() + public List getEnabledCleanupConsumers() { return enabledCleanupConsumers; } - public void setEnabledCleanupConsumers( List enabledCleanupConsumers ) + public void setEnabledCleanupConsumers( List enabledCleanupConsumers ) { this.enabledCleanupConsumers = enabledCleanupConsumers; } diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/legacy/DeleteLegacyArtifactPathAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/legacy/DeleteLegacyArtifactPathAction.java index e337a23db..f85f57cff 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/legacy/DeleteLegacyArtifactPathAction.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/legacy/DeleteLegacyArtifactPathAction.java @@ -49,7 +49,7 @@ public class DeleteLegacyArtifactPathAction { log.info( "remove [" + path + "] from legacy artifact path resolution" ); Configuration configuration = archivaConfiguration.getConfiguration(); - for ( Iterator iterator = configuration.getLegacyArtifactPaths().iterator(); iterator.hasNext(); ) + for ( Iterator iterator = configuration.getLegacyArtifactPaths().iterator(); iterator.hasNext(); ) { LegacyArtifactPath legacyArtifactPath = (LegacyArtifactPath) iterator.next(); if (legacyArtifactPath.match( path )) diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/networkproxies/NetworkProxiesAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/networkproxies/NetworkProxiesAction.java index fb71165c1..dcbbe4249 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/networkproxies/NetworkProxiesAction.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/networkproxies/NetworkProxiesAction.java @@ -22,6 +22,7 @@ package org.apache.maven.archiva.web.action.admin.networkproxies; import com.opensymphony.xwork2.Preparable; import org.apache.maven.archiva.configuration.ArchivaConfiguration; +import org.apache.maven.archiva.configuration.NetworkProxyConfiguration; import org.apache.maven.archiva.security.ArchivaRoleConstants; import org.apache.maven.archiva.web.action.PlexusActionSupport; import org.codehaus.plexus.redback.rbac.Resource; @@ -47,7 +48,7 @@ public class NetworkProxiesAction */ private ArchivaConfiguration configuration; - private List networkProxies; + private List networkProxies; public void prepare() throws Exception @@ -66,12 +67,12 @@ public class NetworkProxiesAction return bundle; } - public List getNetworkProxies() + public List getNetworkProxies() { return networkProxies; } - public void setNetworkProxies( List networkProxies ) + public void setNetworkProxies( List networkProxies ) { this.networkProxies = networkProxies; } diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/AddAdminRepoConsumerClosure.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/AddAdminRepoConsumerClosure.java index 0db3422ec..89aca8cf5 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/AddAdminRepoConsumerClosure.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/AddAdminRepoConsumerClosure.java @@ -33,11 +33,11 @@ import java.util.List; public class AddAdminRepoConsumerClosure implements Closure { - private List list = new ArrayList(); + private List list = new ArrayList(); - private List selectedIds; + private List selectedIds; - public AddAdminRepoConsumerClosure( List selectedIds ) + public AddAdminRepoConsumerClosure( List selectedIds ) { this.selectedIds = selectedIds; } @@ -58,7 +58,7 @@ public class AddAdminRepoConsumerClosure } } - public List getList() + public List getList() { return list; } diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/AdminRepositoryConsumerComparator.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/AdminRepositoryConsumerComparator.java index 3b4fd844b..583e6d250 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/AdminRepositoryConsumerComparator.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/AdminRepositoryConsumerComparator.java @@ -27,7 +27,7 @@ import java.util.Comparator; * @version $Id$ */ public class AdminRepositoryConsumerComparator - implements Comparator + implements Comparator { private static AdminRepositoryConsumerComparator INSTANCE = new AdminRepositoryConsumerComparator(); @@ -36,7 +36,7 @@ public class AdminRepositoryConsumerComparator return INSTANCE; } - public int compare( Object o1, Object o2 ) + public int compare( AdminRepositoryConsumer o1, AdminRepositoryConsumer o2 ) { if ( o1 == null && o2 == null ) { @@ -53,13 +53,8 @@ public class AdminRepositoryConsumerComparator return -1; } - if ( ( o1 instanceof AdminRepositoryConsumer ) && ( o2 instanceof AdminRepositoryConsumer ) ) - { - String id1 = ( (AdminRepositoryConsumer) o1 ).getId(); - String id2 = ( (AdminRepositoryConsumer) o2 ).getId(); - return id1.compareToIgnoreCase( id2 ); - } - - return 0; + String id1 = o1.getId(); + String id2 = o2.getId(); + return id1.compareToIgnoreCase( id2 ); } } diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/RepositoryScanningAction.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/RepositoryScanningAction.java index 0d8086c1b..599a23d0a 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/RepositoryScanningAction.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/action/admin/scanning/RepositoryScanningAction.java @@ -65,29 +65,29 @@ public class RepositoryScanningAction */ private RepositoryContentConsumers repoconsumerUtil; - private Map fileTypeMap; + private Map fileTypeMap; - private List fileTypeIds; + private List fileTypeIds; /** * List of {@link AdminRepositoryConsumer} objects for consumers of known content. */ - private List knownContentConsumers; + private List knownContentConsumers; /** * List of enabled {@link AdminRepositoryConsumer} objects for consumers of known content. */ - private List enabledKnownContentConsumers; + private List enabledKnownContentConsumers; /** * List of {@link AdminRepositoryConsumer} objects for consumers of invalid/unknown content. */ - private List invalidContentConsumers; + private List invalidContentConsumers; /** * List of enabled {@link AdminRepositoryConsumer} objects for consumers of invalid/unknown content. */ - private List enabledInvalidContentConsumers; + private List enabledInvalidContentConsumers; private String pattern; @@ -141,22 +141,22 @@ public class RepositoryScanningAction return fileTypeId; } - public List getFileTypeIds() + public List getFileTypeIds() { return fileTypeIds; } - public Map getFileTypeMap() + public Map getFileTypeMap() { return fileTypeMap; } - public List getInvalidContentConsumers() + public List getInvalidContentConsumers() { return invalidContentConsumers; } - public List getKnownContentConsumers() + public List getKnownContentConsumers() { return knownContentConsumers; } @@ -200,7 +200,7 @@ public class RepositoryScanningAction this.invalidContentConsumers = addAdminRepoConsumer.getList(); Collections.sort( invalidContentConsumers, AdminRepositoryConsumerComparator.getInstance() ); - fileTypeIds = new ArrayList(); + fileTypeIds = new ArrayList(); fileTypeIds.addAll( fileTypeMap.keySet() ); Collections.sort( fileTypeIds ); } @@ -298,22 +298,22 @@ public class RepositoryScanningAction return SUCCESS; } - public List getEnabledInvalidContentConsumers() + public List getEnabledInvalidContentConsumers() { return enabledInvalidContentConsumers; } - public void setEnabledInvalidContentConsumers( List enabledInvalidContentConsumers ) + public void setEnabledInvalidContentConsumers( List enabledInvalidContentConsumers ) { this.enabledInvalidContentConsumers = enabledInvalidContentConsumers; } - public List getEnabledKnownContentConsumers() + public List getEnabledKnownContentConsumers() { return enabledKnownContentConsumers; } - public void setEnabledKnownContentConsumers( List enabledKnownContentConsumers ) + public void setEnabledKnownContentConsumers( List enabledKnownContentConsumers ) { this.enabledKnownContentConsumers = enabledKnownContentConsumers; } diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/mapper/RepositoryActionMapper.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/mapper/RepositoryActionMapper.java index 55e8698fb..7f1d4d975 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/mapper/RepositoryActionMapper.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/mapper/RepositoryActionMapper.java @@ -90,7 +90,7 @@ public class RepositoryActionMapper } else { - Map params = new HashMap(); + Map params = new HashMap(); if ( path.charAt( 0 ) == '/' ) { @@ -144,10 +144,11 @@ public class RepositoryActionMapper return super.getMapping( httpServletRequest, manager ); } + @SuppressWarnings("unchecked") @Override public String getUriFromActionMapping( ActionMapping actionMapping ) { - Map params = actionMapping.getParams(); + Map params = actionMapping.getParams(); if ( ACTION_BROWSE.equals( actionMapping.getName() ) ) { return BROWSE_PREFIX; @@ -184,7 +185,7 @@ public class RepositoryActionMapper return super.getUriFromActionMapping( actionMapping ); } - private String toUri( Map params, boolean artifactId, boolean version, String method ) + private String toUri( Map params, boolean artifactId, boolean version, String method ) { StringBuffer buf = new StringBuffer(); diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/rss/RssFeedServlet.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/rss/RssFeedServlet.java index 7e16bea22..091489761 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/rss/RssFeedServlet.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/rss/RssFeedServlet.java @@ -39,7 +39,6 @@ import org.apache.commons.lang.StringUtils; import org.apache.maven.archiva.database.ArchivaDatabaseException; import org.apache.maven.archiva.security.AccessDeniedException; import org.apache.maven.archiva.security.ArchivaSecurityException; -import org.apache.maven.archiva.security.ArchivaXworkUser; import org.apache.maven.archiva.security.PrincipalNotFoundException; import org.apache.maven.archiva.security.ServletAuthenticator; import org.apache.maven.archiva.security.UserRepositories; @@ -91,8 +90,6 @@ public class RssFeedServlet private HttpAuthenticator httpAuth; - private ArchivaXworkUser archivaXworkUser; - public void init( javax.servlet.ServletConfig servletConfig ) throws ServletException { @@ -104,7 +101,6 @@ public class RssFeedServlet (ServletAuthenticator) wac.getBean( PlexusToSpringUtils.buildSpringId( ServletAuthenticator.class.getName() ) ); httpAuth = (HttpAuthenticator) wac.getBean( PlexusToSpringUtils.buildSpringId( HttpAuthenticator.ROLE, "basic" ) ); - archivaXworkUser = (ArchivaXworkUser) wac.getBean( PlexusToSpringUtils.buildSpringId( ArchivaXworkUser.class ) ); } public void doGet( HttpServletRequest req, HttpServletResponse res ) diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/ArchivaStartup.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/ArchivaStartup.java index 4a3d1ba6e..5694e6ab7 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/ArchivaStartup.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/startup/ArchivaStartup.java @@ -45,8 +45,8 @@ public class ArchivaStartup SecuritySynchronization securitySync = (SecuritySynchronization) wac.getBean(PlexusToSpringUtils.buildSpringId(SecuritySynchronization.class)); ResolverFactoryInit resolverFactory = (ResolverFactoryInit) wac.getBean(PlexusToSpringUtils.buildSpringId(ResolverFactoryInit.class)); ArchivaTaskScheduler taskScheduler = (ArchivaTaskScheduler) wac.getBean(PlexusToSpringUtils.buildSpringId(ArchivaTaskScheduler.class)); - TaskQueueExecutor databaseUpdateQueue = (TaskQueueExecutor) wac.getBean(PlexusToSpringUtils.buildSpringId(TaskQueueExecutor.class, "database-update")); - TaskQueueExecutor repositoryScanningQueue = (TaskQueueExecutor) wac.getBean(PlexusToSpringUtils.buildSpringId(TaskQueueExecutor.class, "repository-scanning")); + wac.getBean(PlexusToSpringUtils.buildSpringId(TaskQueueExecutor.class, "database-update")); + wac.getBean(PlexusToSpringUtils.buildSpringId(TaskQueueExecutor.class, "repository-scanning")); try { diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DependencyTreeTag.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DependencyTreeTag.java index 985bcb618..e0daabea6 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DependencyTreeTag.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DependencyTreeTag.java @@ -60,11 +60,12 @@ public class DependencyTreeTag private String artifactId; + @SuppressWarnings("unused") private String version; private String nodevar; - private Iterator treeIterator; + private Iterator treeIterator; private List tree; @@ -104,6 +105,7 @@ public class DependencyTreeTag unExposeVariables(); } + @SuppressWarnings("unchecked") public int doStartTag() throws JspException { diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DownloadArtifactTag.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DownloadArtifactTag.java index ddc6d7bbe..8681fa6ba 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DownloadArtifactTag.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/DownloadArtifactTag.java @@ -19,16 +19,15 @@ package org.apache.maven.archiva.web.tags; * under the License. */ -import com.opensymphony.xwork2.util.ValueStack; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import org.apache.struts2.components.Component; -import org.apache.struts2.views.jsp.TagUtils; - import javax.servlet.jsp.JspException; -import javax.servlet.jsp.tagext.TagSupport; + +import org.apache.struts2.components.Component; import org.apache.struts2.views.jsp.ComponentTagSupport; +import com.opensymphony.xwork2.util.ValueStack; + /** * DownloadArtifactTag * diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/GroupIdLink.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/GroupIdLink.java index 7d9fdb86c..866431381 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/GroupIdLink.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/GroupIdLink.java @@ -116,6 +116,7 @@ public class GroupIdLink return determineActionURL( "browse", NAMESPACE, method, req, res, parameters, req.getScheme(), includeContext, encode, false, false ); } + @SuppressWarnings("unchecked") private String determineBrowseGroupActionUrl( String gid ) { parameters.put( "groupId", gid ); diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/PlexusTagUtil.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/PlexusTagUtil.java index 7fef4423a..5b3062e90 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/PlexusTagUtil.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/tags/PlexusTagUtil.java @@ -33,7 +33,7 @@ import javax.servlet.jsp.PageContext; */ public class PlexusTagUtil { - public static Object lookup( PageContext pageContext, Class clazz ) + public static Object lookup( PageContext pageContext, Class clazz ) throws ComponentLookupException { return getContainer( pageContext ).lookup( clazz ); @@ -45,7 +45,7 @@ public class PlexusTagUtil return getContainer( pageContext ).lookup( role ); } - public static Object lookup( PageContext pageContext, Class clazz, String hint ) + public static Object lookup( PageContext pageContext, Class clazz, String hint ) throws ComponentLookupException { return getContainer( pageContext ).lookup( clazz, hint ); diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/util/ContextUtils.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/util/ContextUtils.java index 9bbc49522..9579dbba0 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/util/ContextUtils.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/util/ContextUtils.java @@ -34,11 +34,11 @@ import javax.servlet.jsp.PageContext; */ public class ContextUtils { - private static final Map defaultSchemePortMap; + private static final Map defaultSchemePortMap; static { - defaultSchemePortMap = new HashMap(); + defaultSchemePortMap = new HashMap(); defaultSchemePortMap.put( "http", new Integer( 80 ) ); defaultSchemePortMap.put( "https", new Integer( 443 ) ); } diff --git a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/util/VersionMerger.java b/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/util/VersionMerger.java deleted file mode 100644 index 07e4a702c..000000000 --- a/archiva-modules/archiva-web/archiva-webapp/src/main/java/org/apache/maven/archiva/web/util/VersionMerger.java +++ /dev/null @@ -1,212 +0,0 @@ -package org.apache.maven.archiva.web.util; - -/* - * 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. - */ - -//import org.apache.maven.archiva.indexer.record.StandardArtifactIndexRecord; -//import org.apache.maven.artifact.versioning.DefaultArtifactVersion; -//import org.apache.maven.model.Dependency; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -public class VersionMerger -{ - - public static List /**/ wrap( List /**/ artifacts ) - { - List dependencies = new ArrayList(); - -// for ( Iterator i = artifacts.iterator(); i.hasNext(); ) -// { -// Dependency dependency = (Dependency) i.next(); -// -// dependencies.add( new DependencyWrapper( dependency ) ); -// } - - return dependencies; - } - - public static Collection /**/ artifacts ) - { - Map dependees = new LinkedHashMap(); - -// for ( Iterator i = artifacts.iterator(); i.hasNext(); ) -// { -// StandardArtifactIndexRecord record = (StandardArtifactIndexRecord) i.next(); -// -// String key = record.getGroupId() + ":" + record.getArtifactId(); -// if ( dependees.containsKey( key ) ) -// { -// DependencyWrapper wrapper = (DependencyWrapper) dependees.get( key ); -// wrapper.addVersion( record.getVersion() ); -// } -// else -// { -// DependencyWrapper wrapper = new DependencyWrapper( record ); -// -// dependees.put( key, wrapper ); -// } -// } - - return dependees.values(); - } - -// public static class DependencyWrapper -// { -// private final String groupId; -// -// private final String artifactId; -// -// /** -// * Versions added. We ignore duplicates since you might add those with varying classifiers. -// */ -// private Set versions = new HashSet(); -// -// private String version; -// -// private String scope; -// -// private String classifier; -// -// public DependencyWrapper( StandardArtifactIndexRecord record ) -// { -// this.groupId = record.getGroupId(); -// -// this.artifactId = record.getArtifactId(); -// -// addVersion( record.getVersion() ); -// } -// -// public DependencyWrapper( Dependency dependency ) -// { -// this.groupId = dependency.getGroupId(); -// -// this.artifactId = dependency.getArtifactId(); -// -// this.scope = dependency.getScope(); -// -// this.classifier = dependency.getClassifier(); -// -// addVersion( dependency.getVersion() ); -// } -// -// public String getScope() -// { -// return scope; -// } -// -// public String getClassifier() -// { -// return classifier; -// } -// -// public void addVersion( String version ) -// { -// // We use DefaultArtifactVersion to get the correct sorting order later, however it does not have -// // hashCode properly implemented, so we add it here. -// // TODO: add these methods to the actual DefaultArtifactVersion and use that. -// versions.add( new DefaultArtifactVersion( version ) -// { -// public int hashCode() -// { -// int result; -// result = getBuildNumber(); -// result = 31 * result + getMajorVersion(); -// result = 31 * result + getMinorVersion(); -// result = 31 * result + getIncrementalVersion(); -// result = 31 * result + ( getQualifier() != null ? getQualifier().hashCode() : 0 ); -// return result; -// } -// -// public boolean equals( Object o ) -// { -// if ( this == o ) -// { -// return true; -// } -// if ( o == null || getClass() != o.getClass() ) -// { -// return false; -// } -// -// DefaultArtifactVersion that = (DefaultArtifactVersion) o; -// -// if ( getBuildNumber() != that.getBuildNumber() ) -// { -// return false; -// } -// if ( getIncrementalVersion() != that.getIncrementalVersion() ) -// { -// return false; -// } -// if ( getMajorVersion() != that.getMajorVersion() ) -// { -// return false; -// } -// if ( getMinorVersion() != that.getMinorVersion() ) -// { -// return false; -// } -// if ( getQualifier() != null ? !getQualifier().equals( that.getQualifier() ) -// : that.getQualifier() != null ) -// { -// return false; -// } -// -// return true; -// } -// } ); -// -// if ( versions.size() == 1 ) -// { -// this.version = version; -// } -// else -// { -// this.version = null; -// } -// } -// -// public String getGroupId() -// { -// return groupId; -// } -// -// public String getArtifactId() -// { -// return artifactId; -// } -// -// public List getVersions() -// { -// List versions = new ArrayList( this.versions ); -// Collections.sort( versions ); -// return versions; -// } -// -// public String getVersion() -// { -// return version; -// } -// } -} diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/AbstractWebworkTestCase.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/AbstractWebworkTestCase.java index d8b19eacf..9d4eb3782 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/AbstractWebworkTestCase.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/AbstractWebworkTestCase.java @@ -73,6 +73,7 @@ public abstract class AbstractWebworkTestCase * * NOTE: Don't forget to run {@link #preRequest(ActionSupport)} before each request to your action! */ + @SuppressWarnings("unchecked") protected void assertNoErrors( ActionSupport action ) { List errors = (List) action.getActionErrors(); @@ -91,6 +92,7 @@ public abstract class AbstractWebworkTestCase } } + @SuppressWarnings("unchecked") protected void assertRequestStatus( ActionSupport action, String expectedStatus, String methodName ) throws Exception { diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/SearchActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/SearchActionTest.java index cef9ccc96..68296ed97 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/SearchActionTest.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/SearchActionTest.java @@ -20,7 +20,7 @@ package org.apache.maven.archiva.web.action; */ import java.util.ArrayList; -import java.util.HashMap; +import java.util.Collections; import java.util.List; import org.apache.archiva.indexer.search.RepositorySearch; @@ -153,7 +153,7 @@ public class SearchActionTest versions.add( "1.0" ); versions.add( "1.1" ); - archivaXworkUserControl.expectAndReturn( archivaXworkUser.getActivePrincipal( new HashMap() ), "user", 3 ); + archivaXworkUserControl.expectAndReturn( getActivePrincipal(), "user", 3 ); userReposControl.expectAndReturn( userRepos.getObservableRepositoryIds( "user" ), selectedRepos, 2 ); @@ -177,6 +177,11 @@ public class SearchActionTest searchControl.verify(); daoControl.verify(); } + + private String getActivePrincipal() + { + return archivaXworkUser.getActivePrincipal( Collections.emptyMap() ); + } public void testSearchWithinSearchResults() throws Exception @@ -213,7 +218,7 @@ public class SearchActionTest versions.add( "1.0" ); versions.add( "1.1" ); - archivaXworkUserControl.expectAndReturn( archivaXworkUser.getActivePrincipal( new HashMap() ), "user", 3 ); + archivaXworkUserControl.expectAndReturn( getActivePrincipal(), "user", 3 ); userReposControl.expectAndReturn( userRepos.getObservableRepositoryIds( "user" ), selectedRepos, 2 ); @@ -247,7 +252,7 @@ public class SearchActionTest List selectedRepos = new ArrayList(); - archivaXworkUserControl.expectAndReturn( archivaXworkUser.getActivePrincipal( new HashMap() ), "user" ); + archivaXworkUserControl.expectAndReturn( getActivePrincipal(), "user" ); userReposControl.expectAndReturn( userRepos.getObservableRepositoryIds( "user" ), selectedRepos ); @@ -279,7 +284,7 @@ public class SearchActionTest SearchResults results = new SearchResults(); - archivaXworkUserControl.expectAndReturn( archivaXworkUser.getActivePrincipal( new HashMap() ), "user", 2 ); + archivaXworkUserControl.expectAndReturn( getActivePrincipal(), "user", 2 ); userReposControl.expectAndReturn( userRepos.getObservableRepositoryIds( "user" ), selectedRepos ); @@ -334,7 +339,7 @@ public class SearchActionTest SearchFields searchFields = new SearchFields( "org", null, null, null, null, selectedRepos ); - archivaXworkUserControl.expectAndReturn( archivaXworkUser.getActivePrincipal( new HashMap() ), "user" ); + archivaXworkUserControl.expectAndReturn( getActivePrincipal(), "user" ); searchControl.expectAndReturn( search.search( "user", searchFields, limits ), results ); @@ -384,7 +389,7 @@ public class SearchActionTest SearchFields searchFields = new SearchFields( "org", null, null, null, null, selectedRepos ); - archivaXworkUserControl.expectAndReturn( archivaXworkUser.getActivePrincipal( new HashMap() ), "user", 2 ); + archivaXworkUserControl.expectAndReturn( getActivePrincipal(), "user", 2 ); userReposControl.expectAndReturn( userRepos.getObservableRepositoryIds( "user" ), selectedRepos ); @@ -429,7 +434,7 @@ public class SearchActionTest SearchFields searchFields = new SearchFields( "org", null, null, null, null, selectedRepos ); - archivaXworkUserControl.expectAndReturn( archivaXworkUser.getActivePrincipal( new HashMap() ), "user" ); + archivaXworkUserControl.expectAndReturn( getActivePrincipal(), "user" ); searchControl.expectAndReturn( search.search( "user", searchFields, limits ), results ); diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/appearance/OrganizationInfoActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/appearance/OrganizationInfoActionTest.java index 27772e51e..336f1097f 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/appearance/OrganizationInfoActionTest.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/appearance/OrganizationInfoActionTest.java @@ -19,11 +19,9 @@ package org.apache.maven.archiva.web.action.admin.appearance; * under the License. */ -import com.opensymphony.xwork2.Action; -import org.apache.maven.archiva.configuration.ArchivaConfiguration; import org.apache.maven.archiva.configuration.OrganisationInformation; -import org.apache.maven.archiva.configuration.Configuration; -import org.apache.maven.archiva.web.action.AbstractWebworkTestCase; + +import com.opensymphony.xwork2.Action; /** */ diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/AddProxyConnectorActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/AddProxyConnectorActionTest.java index 076f6c01e..cc7d51889 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/AddProxyConnectorActionTest.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/AddProxyConnectorActionTest.java @@ -117,6 +117,7 @@ public class AddProxyConnectorActionTest assertEquals( 1, connector.getProperties().size() ); } + @SuppressWarnings("unchecked") public void testAddProxyConnectorCommit() throws Exception { @@ -385,6 +386,7 @@ public class AddProxyConnectorActionTest archivaConfiguration.save( config ); } + @SuppressWarnings("unchecked") private void populateProxyConnector( ProxyConnectorConfiguration connector ) { connector.setProxyId( AbstractProxyConnectorFormAction.DIRECT_CONNECTION ); diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/EditProxyConnectorActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/EditProxyConnectorActionTest.java index 366f0643c..bfb5e915f 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/EditProxyConnectorActionTest.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/connectors/proxy/EditProxyConnectorActionTest.java @@ -159,6 +159,7 @@ public class EditProxyConnectorActionTest assertEquals( 1, connector.getWhiteListPatterns().size() ); } + @SuppressWarnings("unchecked") public void testEditProxyConnectorCommit() throws Exception { @@ -375,6 +376,7 @@ public class EditProxyConnectorActionTest assertEquals( TEST_TARGET_ID, connector.getTargetRepoId() ); } + @SuppressWarnings("unchecked") private Configuration createInitialConfiguration() { Configuration config = new Configuration(); diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/AbstractManagedRepositoryArchivaDAOStub.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/AbstractManagedRepositoryArchivaDAOStub.java index b3456aa36..0f17dd28c 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/AbstractManagedRepositoryArchivaDAOStub.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/AbstractManagedRepositoryArchivaDAOStub.java @@ -28,6 +28,7 @@ import org.apache.maven.archiva.database.ProjectModelDAO; import org.apache.maven.archiva.database.RepositoryContentStatisticsDAO; import org.apache.maven.archiva.database.RepositoryProblemDAO; import org.apache.maven.archiva.database.SimpleConstraint; +import org.apache.maven.archiva.model.RepositoryContentStatistics; /** * AbstractManagedRepositoryArchivaDAOStub @@ -52,7 +53,7 @@ public class AbstractManagedRepositoryArchivaDAOStub */ private RepositoryContentStatisticsDAO repoContentStatisticsDAO; - public List query( SimpleConstraint constraint ) + public List query( SimpleConstraint constraint ) { return null; } diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/ArchivaDAOStub.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/ArchivaDAOStub.java index 7141af57c..7437342d8 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/ArchivaDAOStub.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/ArchivaDAOStub.java @@ -44,7 +44,7 @@ public class ArchivaDAOStub { private ArchivaConfiguration configuration; - public List query( SimpleConstraint constraint ) + public List query( SimpleConstraint constraint ) { Assert.assertEquals( RepositoryContentStatistics.class, constraint.getResultClass() ); diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/ProjectModelDAOStub.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/ProjectModelDAOStub.java index 9b912692f..e18b2b5ff 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/ProjectModelDAOStub.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/ProjectModelDAOStub.java @@ -60,7 +60,7 @@ public class ProjectModelDAOStub return projectModel; } - public List queryProjectModels( Constraint constraint ) + public List queryProjectModels( Constraint constraint ) throws ObjectNotFoundException, ArchivaDatabaseException { // TODO Auto-generated method stub diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoryContentStatisticsDAOStub.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoryContentStatisticsDAOStub.java index fbfd24e20..9825d2b11 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoryContentStatisticsDAOStub.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoryContentStatisticsDAOStub.java @@ -46,7 +46,7 @@ public class RepositoryContentStatisticsDAOStub Assert.assertEquals( "repo-ident", stats.getRepositoryId() ); } - public List queryRepositoryContentStatistics( Constraint constraint ) + public List queryRepositoryContentStatistics( Constraint constraint ) throws ObjectNotFoundException, ArchivaDatabaseException { Assert.assertTrue( constraint instanceof RepositoryContentStatisticsByRepositoryConstraint ); diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoryGroupsActionTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoryGroupsActionTest.java index 7a90f7878..c4ad7616f 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoryGroupsActionTest.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/action/admin/repositories/RepositoryGroupsActionTest.java @@ -20,6 +20,7 @@ package org.apache.maven.archiva.web.action.admin.repositories; */ import java.util.Collections; +import java.util.List; import org.apache.maven.archiva.configuration.ArchivaConfiguration; import org.apache.maven.archiva.configuration.Configuration; @@ -177,7 +178,7 @@ public class RepositoryGroupsActionTest assertNotNull( action.getGroupToRepositoryMap() ); assertEquals( 1, action.getGroupToRepositoryMap().size() ); - java.util.List repos = action.getGroupToRepositoryMap().get( repoGroup.getId() ); + List repos = action.getGroupToRepositoryMap().get( repoGroup.getId() ); assertEquals( 1, repos.size() ); assertEquals( REPO2_ID, repos.get( 0 ) ); } @@ -207,7 +208,7 @@ public class RepositoryGroupsActionTest assertNotNull( action.getGroupToRepositoryMap() ); assertEquals( 1, action.getGroupToRepositoryMap().size() ); - java.util.List repos = action.getGroupToRepositoryMap().get( repoGroup.getId() ); + List repos = action.getGroupToRepositoryMap().get( repoGroup.getId() ); assertEquals( 1, repos.size() ); assertEquals( REPO2_ID, repos.get( 0 ) ); @@ -256,7 +257,7 @@ public class RepositoryGroupsActionTest assertNotNull( action.getGroupToRepositoryMap() ); assertEquals( 1, action.getGroupToRepositoryMap().size() ); - java.util.List repos = action.getGroupToRepositoryMap().get( repoGroup.getId() ); + List repos = action.getGroupToRepositoryMap().get( repoGroup.getId() ); assertEquals( 1, repos.size() ); assertEquals( REPO2_ID, repos.get( 0 ) ); @@ -307,7 +308,7 @@ public class RepositoryGroupsActionTest assertNotNull( action.getGroupToRepositoryMap() ); assertEquals( 1, action.getGroupToRepositoryMap().size() ); - java.util.List repos = action.getGroupToRepositoryMap().get( repoGroup.getId() ); + List repos = action.getGroupToRepositoryMap().get( repoGroup.getId() ); assertEquals( 1, repos.size() ); assertEquals( REPO2_ID, repos.get( 0 ) ); @@ -343,7 +344,7 @@ public class RepositoryGroupsActionTest assertNotNull( action.getGroupToRepositoryMap() ); assertEquals( 1, action.getGroupToRepositoryMap().size() ); - java.util.List repos = action.getGroupToRepositoryMap().get( repoGroup.getId() ); + List repos = action.getGroupToRepositoryMap().get( repoGroup.getId() ); assertEquals( 1, repos.size() ); assertEquals( REPO2_ID, repos.get( 0 ) ); diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/rss/ArtifactDAOStub.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/rss/ArtifactDAOStub.java index c4ebafe95..3a4f66c84 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/rss/ArtifactDAOStub.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/rss/ArtifactDAOStub.java @@ -61,7 +61,7 @@ public class ArtifactDAOStub return null; } - public List queryArtifacts( Constraint constraint ) + public List queryArtifacts( Constraint constraint ) throws ObjectNotFoundException, ArchivaDatabaseException { List artifacts = new ArrayList(); diff --git a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/rss/RssFeedServletTest.java b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/rss/RssFeedServletTest.java index e5068fdff..684fd4a67 100644 --- a/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/rss/RssFeedServletTest.java +++ b/archiva-modules/archiva-web/archiva-webapp/src/test/java/org/apache/maven/archiva/web/rss/RssFeedServletTest.java @@ -19,8 +19,6 @@ package org.apache.maven.archiva.web.rss; * under the License. */ -import java.io.IOException; - import javax.servlet.http.HttpServletResponse; import org.apache.commons.codec.Encoder; @@ -113,7 +111,8 @@ public class RssFeedServletTest try { - WebResponse response = client.getResponse( "http://localhost/feeds?invalid_param=xxx" ); + client.getResponse( "http://localhost/feeds?invalid_param=xxx" ); + fail( "Expected exception" ); } catch ( HttpException he ) { @@ -139,7 +138,8 @@ public class RssFeedServletTest try { - WebResponse response = client.getResponse( request ); + client.getResponse( request ); + fail( "Expected exception" ); } catch ( HttpException he ) { @@ -165,7 +165,8 @@ public class RssFeedServletTest try { - WebResponse response = client.getResponse( request ); + client.getResponse( request ); + fail( "Expected exception" ); } catch ( HttpException he ) {