clean up warnings in webapp

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@755318 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Porter 2009-03-17 16:53:49 +00:00
parent 9e46c25ca2
commit dddb1c3b45
37 changed files with 141 additions and 388 deletions

View File

@ -34,7 +34,7 @@ import org.codehaus.plexus.redback.users.UserManager;
*/
public class ArchivaXworkUser
{
public String getActivePrincipal( Map<String, Object> sessionMap )
public String getActivePrincipal( Map<String, ?> sessionMap )
{
SecuritySession securitySession =
(SecuritySession) sessionMap.get( SecuritySystemConstants.SECURITY_SESSION_KEY );

View File

@ -204,6 +204,7 @@ public class BrowseAction
}
}
@SuppressWarnings("unchecked")
private String getPrincipal()
{
return archivaXworkUser.getActivePrincipal( ActionContext.getContext().getSession() );

View File

@ -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() );

View File

@ -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;
}
}

View File

@ -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<ArchivaProjectModel> dependees;
/**
* The reports associated with this versioned project.
*/
private List reports;
private List<MailingList> mailingLists;
private List mailingLists;
private List dependencies;
private List<Dependency> dependencies;
private List<String> 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<MailingList> getMailingLists()
{
return mailingLists;
}
public List getDependencies()
public List<Dependency> getDependencies()
{
return dependencies;
}
public List getDependees()
public List<ArchivaProjectModel> getDependees()
{
return dependees;
}

View File

@ -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() );

View File

@ -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
*/

View File

@ -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<String>( 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<String, Object> properties = connector.getProperties();
for ( String key : properties.keySet() )
{
String key = (String) j.next();
Object value = properties.get( key );
if ( value.getClass().isArray() )
{

View File

@ -33,11 +33,11 @@ import java.util.List;
public class AddAdminDatabaseConsumerClosure
implements Closure
{
private List list = new ArrayList();
private List<AdminDatabaseConsumer> list = new ArrayList<AdminDatabaseConsumer>();
private List selectedIds;
private List<String> selectedIds;
public AddAdminDatabaseConsumerClosure( List selectedIds )
public AddAdminDatabaseConsumerClosure( List<String> selectedIds )
{
this.selectedIds = selectedIds;
}
@ -59,7 +59,7 @@ public class AddAdminDatabaseConsumerClosure
}
}
public List getList()
public List<AdminDatabaseConsumer> getList()
{
return list;
}

View File

@ -27,7 +27,7 @@ import java.util.Comparator;
* @version $Id$
*/
public class AdminDatabaseConsumerComparator
implements Comparator
implements Comparator<AdminDatabaseConsumer>
{
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 );
}
}

View File

@ -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<AdminDatabaseConsumer> unprocessedConsumers;
/**
* List of enabled {@link AdminDatabaseConsumer} objects for unprocessed artifacts.
*/
private List enabledUnprocessedConsumers;
private List<String> enabledUnprocessedConsumers;
/**
* List of {@link AdminDatabaseConsumer} objects for "to cleanup" artifacts.
*/
private List cleanupConsumers;
private List<AdminDatabaseConsumer> cleanupConsumers;
/**
* List of enabled {@link AdminDatabaseConsumer} objects for "to cleanup" artifacts.
*/
private List enabledCleanupConsumers;
private List<String> 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<AdminDatabaseConsumer> getCleanupConsumers()
{
return cleanupConsumers;
}
public List getUnprocessedConsumers()
public List<AdminDatabaseConsumer> getUnprocessedConsumers()
{
return unprocessedConsumers;
}
public List getEnabledUnprocessedConsumers()
public List<String> getEnabledUnprocessedConsumers()
{
return enabledUnprocessedConsumers;
}
public void setEnabledUnprocessedConsumers( List enabledUnprocessedConsumers )
public void setEnabledUnprocessedConsumers( List<String> enabledUnprocessedConsumers )
{
this.enabledUnprocessedConsumers = enabledUnprocessedConsumers;
}
public List getEnabledCleanupConsumers()
public List<String> getEnabledCleanupConsumers()
{
return enabledCleanupConsumers;
}
public void setEnabledCleanupConsumers( List enabledCleanupConsumers )
public void setEnabledCleanupConsumers( List<String> enabledCleanupConsumers )
{
this.enabledCleanupConsumers = enabledCleanupConsumers;
}

View File

@ -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<LegacyArtifactPath> iterator = configuration.getLegacyArtifactPaths().iterator(); iterator.hasNext(); )
{
LegacyArtifactPath legacyArtifactPath = (LegacyArtifactPath) iterator.next();
if (legacyArtifactPath.match( path ))

View File

@ -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<NetworkProxyConfiguration> networkProxies;
public void prepare()
throws Exception
@ -66,12 +67,12 @@ public class NetworkProxiesAction
return bundle;
}
public List getNetworkProxies()
public List<NetworkProxyConfiguration> getNetworkProxies()
{
return networkProxies;
}
public void setNetworkProxies( List networkProxies )
public void setNetworkProxies( List<NetworkProxyConfiguration> networkProxies )
{
this.networkProxies = networkProxies;
}

View File

@ -33,11 +33,11 @@ import java.util.List;
public class AddAdminRepoConsumerClosure
implements Closure
{
private List list = new ArrayList();
private List<AdminRepositoryConsumer> list = new ArrayList<AdminRepositoryConsumer>();
private List selectedIds;
private List<String> selectedIds;
public AddAdminRepoConsumerClosure( List selectedIds )
public AddAdminRepoConsumerClosure( List<String> selectedIds )
{
this.selectedIds = selectedIds;
}
@ -58,7 +58,7 @@ public class AddAdminRepoConsumerClosure
}
}
public List getList()
public List<AdminRepositoryConsumer> getList()
{
return list;
}

View File

@ -27,7 +27,7 @@ import java.util.Comparator;
* @version $Id$
*/
public class AdminRepositoryConsumerComparator
implements Comparator
implements Comparator<AdminRepositoryConsumer>
{
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 );
}
}

View File

@ -65,29 +65,29 @@ public class RepositoryScanningAction
*/
private RepositoryContentConsumers repoconsumerUtil;
private Map fileTypeMap;
private Map<String, FileType> fileTypeMap;
private List fileTypeIds;
private List<String> fileTypeIds;
/**
* List of {@link AdminRepositoryConsumer} objects for consumers of known content.
*/
private List knownContentConsumers;
private List<AdminRepositoryConsumer> knownContentConsumers;
/**
* List of enabled {@link AdminRepositoryConsumer} objects for consumers of known content.
*/
private List enabledKnownContentConsumers;
private List<String> enabledKnownContentConsumers;
/**
* List of {@link AdminRepositoryConsumer} objects for consumers of invalid/unknown content.
*/
private List invalidContentConsumers;
private List<AdminRepositoryConsumer> invalidContentConsumers;
/**
* List of enabled {@link AdminRepositoryConsumer} objects for consumers of invalid/unknown content.
*/
private List enabledInvalidContentConsumers;
private List<String> enabledInvalidContentConsumers;
private String pattern;
@ -141,22 +141,22 @@ public class RepositoryScanningAction
return fileTypeId;
}
public List getFileTypeIds()
public List<String> getFileTypeIds()
{
return fileTypeIds;
}
public Map getFileTypeMap()
public Map<String, FileType> getFileTypeMap()
{
return fileTypeMap;
}
public List getInvalidContentConsumers()
public List<AdminRepositoryConsumer> getInvalidContentConsumers()
{
return invalidContentConsumers;
}
public List getKnownContentConsumers()
public List<AdminRepositoryConsumer> 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<String>();
fileTypeIds.addAll( fileTypeMap.keySet() );
Collections.sort( fileTypeIds );
}
@ -298,22 +298,22 @@ public class RepositoryScanningAction
return SUCCESS;
}
public List getEnabledInvalidContentConsumers()
public List<String> getEnabledInvalidContentConsumers()
{
return enabledInvalidContentConsumers;
}
public void setEnabledInvalidContentConsumers( List enabledInvalidContentConsumers )
public void setEnabledInvalidContentConsumers( List<String> enabledInvalidContentConsumers )
{
this.enabledInvalidContentConsumers = enabledInvalidContentConsumers;
}
public List getEnabledKnownContentConsumers()
public List<String> getEnabledKnownContentConsumers()
{
return enabledKnownContentConsumers;
}
public void setEnabledKnownContentConsumers( List enabledKnownContentConsumers )
public void setEnabledKnownContentConsumers( List<String> enabledKnownContentConsumers )
{
this.enabledKnownContentConsumers = enabledKnownContentConsumers;
}

View File

@ -90,7 +90,7 @@ public class RepositoryActionMapper
}
else
{
Map params = new HashMap();
Map<String, String> params = new HashMap<String, String>();
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<String, String> 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<String, String> params, boolean artifactId, boolean version, String method )
{
StringBuffer buf = new StringBuffer();

View File

@ -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 )

View File

@ -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
{

View File

@ -60,11 +60,12 @@ public class DependencyTreeTag
private String artifactId;
@SuppressWarnings("unused")
private String version;
private String nodevar;
private Iterator treeIterator;
private Iterator<TreeEntry> treeIterator;
private List<TreeEntry> tree;
@ -104,6 +105,7 @@ public class DependencyTreeTag
unExposeVariables();
}
@SuppressWarnings("unchecked")
public int doStartTag()
throws JspException
{

View File

@ -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
*

View File

@ -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 );

View File

@ -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 );

View File

@ -34,11 +34,11 @@ import javax.servlet.jsp.PageContext;
*/
public class ContextUtils
{
private static final Map defaultSchemePortMap;
private static final Map<String, Integer> defaultSchemePortMap;
static
{
defaultSchemePortMap = new HashMap();
defaultSchemePortMap = new HashMap<String, Integer>();
defaultSchemePortMap.put( "http", new Integer( 80 ) );
defaultSchemePortMap.put( "https", new Integer( 443 ) );
}

View File

@ -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 /*<DependencyWrapper>*/ wrap( List /*<StandardArtifactIndexRecord>*/ 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 /*<DependencyWrapper*/ merge( Collection /*<StandardArtifactIndexRecord>*/ 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;
// }
// }
}

View File

@ -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<String> errors = (List<String>) action.getActionErrors();
@ -91,6 +92,7 @@ public abstract class AbstractWebworkTestCase
}
}
@SuppressWarnings("unchecked")
protected void assertRequestStatus( ActionSupport action, String expectedStatus, String methodName )
throws Exception
{

View File

@ -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.<String,Object>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<String> selectedRepos = new ArrayList<String>();
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 );

View File

@ -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;
/**
*/

View File

@ -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 );

View File

@ -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();

View File

@ -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<RepositoryContentStatistics> query( SimpleConstraint constraint )
{
return null;
}

View File

@ -44,7 +44,7 @@ public class ArchivaDAOStub
{
private ArchivaConfiguration configuration;
public List query( SimpleConstraint constraint )
public List<RepositoryContentStatistics> query( SimpleConstraint constraint )
{
Assert.assertEquals( RepositoryContentStatistics.class, constraint.getResultClass() );

View File

@ -60,7 +60,7 @@ public class ProjectModelDAOStub
return projectModel;
}
public List queryProjectModels( Constraint constraint )
public List<ArchivaProjectModel> queryProjectModels( Constraint constraint )
throws ObjectNotFoundException, ArchivaDatabaseException
{
// TODO Auto-generated method stub

View File

@ -46,7 +46,7 @@ public class RepositoryContentStatisticsDAOStub
Assert.assertEquals( "repo-ident", stats.getRepositoryId() );
}
public List queryRepositoryContentStatistics( Constraint constraint )
public List<RepositoryContentStatistics> queryRepositoryContentStatistics( Constraint constraint )
throws ObjectNotFoundException, ArchivaDatabaseException
{
Assert.assertTrue( constraint instanceof RepositoryContentStatisticsByRepositoryConstraint );

View File

@ -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<String> 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<String> 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<String> 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<String> 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<String> repos = action.getGroupToRepositoryMap().get( repoGroup.getId() );
assertEquals( 1, repos.size() );
assertEquals( REPO2_ID, repos.get( 0 ) );

View File

@ -61,7 +61,7 @@ public class ArtifactDAOStub
return null;
}
public List queryArtifacts( Constraint constraint )
public List<ArchivaArtifact> queryArtifacts( Constraint constraint )
throws ObjectNotFoundException, ArchivaDatabaseException
{
List<ArchivaArtifact> artifacts = new ArrayList<ArchivaArtifact>();

View File

@ -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 )
{