clean up warnings

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@755286 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Brett Porter 2009-03-17 15:45:22 +00:00
parent 8bd81e6d6f
commit 969828589e
4 changed files with 38 additions and 65 deletions

View File

@ -49,7 +49,7 @@ public class SearchResultHit
private String repositoryId = ""; private String repositoryId = "";
private List<String> versions = new ArrayList(); private List<String> versions = new ArrayList<String>();
private ArchivaArtifact artifact; private ArchivaArtifact artifact;

View File

@ -32,9 +32,7 @@ import java.util.Map;
*/ */
public class SearchResults public class SearchResults
{ {
private List repositories = new ArrayList(); private Map<String, SearchResultHit> hits = new HashMap<String, SearchResultHit>();
private Map<String, SearchResultHit> hits = new HashMap();
private int totalHits; private int totalHits;
@ -58,7 +56,7 @@ public class SearchResults
*/ */
public List<SearchResultHit> getHits() public List<SearchResultHit> getHits()
{ {
return new ArrayList( hits.values() ); return new ArrayList<SearchResultHit>( hits.values() );
} }
public Map<String, SearchResultHit> getHitsMap() public Map<String, SearchResultHit> getHitsMap()
@ -66,21 +64,11 @@ public class SearchResults
return hits; return hits;
} }
public List getRepositories()
{
return repositories;
}
public boolean isEmpty() public boolean isEmpty()
{ {
return hits.isEmpty(); return hits.isEmpty();
} }
public void setRepositories( List repositories )
{
this.repositories = repositories;
}
public SearchResultLimits getLimits() public SearchResultLimits getLimits()
{ {
return limits; return limits;

View File

@ -179,6 +179,7 @@ public class ArchivaModelCloner
return cloned; return cloned;
} }
@SuppressWarnings("unchecked")
public static Properties clone( Properties properties ) public static Properties clone( Properties properties )
{ {
if ( properties == null ) if ( properties == null )
@ -188,7 +189,7 @@ public class ArchivaModelCloner
Properties cloned = new Properties(); Properties cloned = new Properties();
Enumeration keys = properties.propertyNames(); Enumeration<String> keys = (Enumeration<String>) properties.propertyNames();
while ( keys.hasMoreElements() ) while ( keys.hasMoreElements() )
{ {
String key = (String) keys.nextElement(); String key = (String) keys.nextElement();
@ -246,39 +247,34 @@ public class ArchivaModelCloner
return cloned; return cloned;
} }
public static List cloneArtifactReferences( List artifactReferenceList ) public static List<ArtifactReference> cloneArtifactReferences( List<ArtifactReference> artifactReferenceList )
{ {
if ( artifactReferenceList == null ) if ( artifactReferenceList == null )
{ {
return null; return null;
} }
List ret = new ArrayList(); List<ArtifactReference> ret = new ArrayList<ArtifactReference>();
Iterator it = artifactReferenceList.iterator(); for ( ArtifactReference ref : artifactReferenceList )
while ( it.hasNext() )
{ {
ArtifactReference artifactReference = (ArtifactReference) it.next(); ret.add( clone( ref ) );
ret.add( clone( artifactReference ) );
} }
return ret; return ret;
} }
public static List cloneDependencies( List dependencies ) public static List<Dependency> cloneDependencies( List<Dependency> dependencies )
{ {
if ( dependencies == null ) if ( dependencies == null )
{ {
return null; return null;
} }
List ret = new ArrayList(); List<Dependency> ret = new ArrayList<Dependency>();
Iterator it = dependencies.iterator(); for ( Dependency dep : dependencies )
while ( it.hasNext() )
{ {
Dependency dep = (Dependency) it.next();
if ( dep == null ) if ( dep == null )
{ {
// Skip null dependency. // Skip null dependency.
@ -291,19 +287,17 @@ public class ArchivaModelCloner
return ret; return ret;
} }
public static List cloneExclusions( List exclusions ) public static List<Exclusion> cloneExclusions( List<Exclusion> exclusions )
{ {
if ( exclusions == null ) if ( exclusions == null )
{ {
return null; return null;
} }
List ret = new ArrayList(); List<Exclusion> ret = new ArrayList<Exclusion>();
Iterator it = exclusions.iterator(); for ( Exclusion exclusion : exclusions )
while ( it.hasNext() )
{ {
Exclusion exclusion = (Exclusion) it.next();
Exclusion cloned = new Exclusion(); Exclusion cloned = new Exclusion();
cloned.setGroupId( exclusion.getGroupId() ); cloned.setGroupId( exclusion.getGroupId() );
@ -315,19 +309,19 @@ public class ArchivaModelCloner
return ret; return ret;
} }
public static List cloneIndividuals( List individuals ) public static List<Individual> cloneIndividuals( List<Individual> individuals )
{ {
if ( individuals == null ) if ( individuals == null )
{ {
return individuals; return individuals;
} }
List ret = new ArrayList(); List<Individual> ret = new ArrayList<Individual>();
Iterator it = individuals.iterator(); Iterator<Individual> it = individuals.iterator();
while ( it.hasNext() ) while ( it.hasNext() )
{ {
Individual individual = (Individual) it.next(); Individual individual = it.next();
Individual cloned = new Individual(); Individual cloned = new Individual();
cloned.setPrincipal( individual.getPrincipal() ); cloned.setPrincipal( individual.getPrincipal() );
@ -348,19 +342,17 @@ public class ArchivaModelCloner
return ret; return ret;
} }
public static List cloneLicenses( List licenses ) public static List<License> cloneLicenses( List<License> licenses )
{ {
if ( licenses == null ) if ( licenses == null )
{ {
return null; return null;
} }
List ret = new ArrayList(); List<License> ret = new ArrayList<License>();
Iterator it = licenses.iterator(); for ( License license : licenses )
while ( it.hasNext() )
{ {
License license = (License) it.next();
License cloned = new License(); License cloned = new License();
cloned.setId( license.getId() ); cloned.setId( license.getId() );
@ -374,20 +366,17 @@ public class ArchivaModelCloner
return ret; return ret;
} }
public static List cloneMailingLists( List mailingLists ) public static List<MailingList> cloneMailingLists( List<MailingList> mailingLists )
{ {
if ( mailingLists == null ) if ( mailingLists == null )
{ {
return null; return null;
} }
List ret = new ArrayList(); List<MailingList> ret = new ArrayList<MailingList>();
Iterator it = mailingLists.iterator(); for ( MailingList mailingList : mailingLists )
while ( it.hasNext() )
{ {
MailingList mailingList = (MailingList) it.next();
if ( mailingList == null ) if ( mailingList == null )
{ {
// Skip null mailing list. // Skip null mailing list.
@ -400,29 +389,27 @@ public class ArchivaModelCloner
return ret; return ret;
} }
public static List clonePlugins( List plugins ) public static List<ArtifactReference> clonePlugins( List<ArtifactReference> plugins )
{ {
return cloneArtifactReferences( plugins ); return cloneArtifactReferences( plugins );
} }
public static List cloneReports( List reports ) public static List<ArtifactReference> cloneReports( List<ArtifactReference> reports )
{ {
return cloneArtifactReferences( reports ); return cloneArtifactReferences( reports );
} }
public static List cloneRepositories( List repositories ) public static List<ProjectRepository> cloneRepositories( List<ProjectRepository> repositories )
{ {
if ( repositories == null ) if ( repositories == null )
{ {
return null; return null;
} }
List ret = new ArrayList(); List<ProjectRepository> ret = new ArrayList<ProjectRepository>();
Iterator it = repositories.iterator(); for ( ProjectRepository repository : repositories )
while ( it.hasNext() )
{ {
ProjectRepository repository = (ProjectRepository) it.next();
ProjectRepository cloned = new ProjectRepository(); ProjectRepository cloned = new ProjectRepository();
cloned.setId( repository.getId() ); cloned.setId( repository.getId() );
@ -439,32 +426,29 @@ public class ArchivaModelCloner
return ret; return ret;
} }
public static List cloneRoles( List roles ) public static List<String> cloneRoles( List<String> roles )
{ {
return cloneSimpleStringList( roles ); return cloneSimpleStringList( roles );
} }
private static List cloneSimpleStringList( List simple ) private static List<String> cloneSimpleStringList( List<String> simple )
{ {
if ( simple == null ) if ( simple == null )
{ {
return null; return null;
} }
List ret = new ArrayList(); List<String> ret = new ArrayList<String>();
Iterator it = simple.iterator(); for ( String txt : simple )
while ( it.hasNext() )
{ {
String txt = (String) it.next();
ret.add( txt ); ret.add( txt );
} }
return ret; return ret;
} }
public static List cloneAvailableVersions( List availableVersions ) public static List<String> cloneAvailableVersions( List<String> availableVersions )
{ {
return cloneSimpleStringList( availableVersions ); return cloneSimpleStringList( availableVersions );
} }

View File

@ -24,6 +24,7 @@ import org.apache.maven.archiva.database.ArchivaDatabaseException;
import org.apache.maven.archiva.database.Constraint; import org.apache.maven.archiva.database.Constraint;
import org.apache.maven.archiva.database.ObjectNotFoundException; import org.apache.maven.archiva.database.ObjectNotFoundException;
import org.apache.maven.archiva.database.constraints.RepositoryProblemByTypeConstraint; import org.apache.maven.archiva.database.constraints.RepositoryProblemByTypeConstraint;
import org.apache.maven.archiva.model.RepositoryProblem;
import org.apache.maven.archiva.reporting.DataLimits; import org.apache.maven.archiva.reporting.DataLimits;
import org.apache.maven.archiva.reporting.DynamicReportSource; import org.apache.maven.archiva.reporting.DynamicReportSource;
@ -59,13 +60,13 @@ public class MetadataReport
constraint = new RepositoryProblemByTypeConstraint( PROBLEM_TYPE_METADATA ); constraint = new RepositoryProblemByTypeConstraint( PROBLEM_TYPE_METADATA );
} }
public List getData() public List<RepositoryProblem> getData()
throws ObjectNotFoundException, ArchivaDatabaseException throws ObjectNotFoundException, ArchivaDatabaseException
{ {
return dao.getRepositoryProblemDAO().queryRepositoryProblems( constraint ); return dao.getRepositoryProblemDAO().queryRepositoryProblems( constraint );
} }
public List getData( DataLimits limits ) public List<RepositoryProblem> getData( DataLimits limits )
throws ObjectNotFoundException, ArchivaDatabaseException throws ObjectNotFoundException, ArchivaDatabaseException
{ {
// TODO: implement limits. // TODO: implement limits.