From: Brett Porter Date: Tue, 17 Mar 2009 15:45:22 +0000 (+0000) Subject: clean up warnings X-Git-Tag: archiva-1.2~45 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=969828589ebe916effe6b61ad16b34b799c640ec;p=archiva.git clean up warnings git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@755286 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/SearchResultHit.java b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/SearchResultHit.java index c5a1f0134..e966f85c4 100644 --- a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/SearchResultHit.java +++ b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/SearchResultHit.java @@ -49,7 +49,7 @@ public class SearchResultHit private String repositoryId = ""; - private List versions = new ArrayList(); + private List versions = new ArrayList(); private ArchivaArtifact artifact; diff --git a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/SearchResults.java b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/SearchResults.java index 4fc3e22b7..4fa5d1d35 100644 --- a/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/SearchResults.java +++ b/archiva-modules/archiva-base/archiva-indexer/src/main/java/org/apache/archiva/indexer/search/SearchResults.java @@ -32,9 +32,7 @@ import java.util.Map; */ public class SearchResults { - private List repositories = new ArrayList(); - - private Map hits = new HashMap(); + private Map hits = new HashMap(); private int totalHits; @@ -58,7 +56,7 @@ public class SearchResults */ public List getHits() { - return new ArrayList( hits.values() ); + return new ArrayList( hits.values() ); } public Map getHitsMap() @@ -66,21 +64,11 @@ public class SearchResults return hits; } - public List getRepositories() - { - return repositories; - } - public boolean isEmpty() { return hits.isEmpty(); } - public void setRepositories( List repositories ) - { - this.repositories = repositories; - } - public SearchResultLimits getLimits() { return limits; diff --git a/archiva-modules/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaModelCloner.java b/archiva-modules/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaModelCloner.java index 8eba80c1f..b77840150 100644 --- a/archiva-modules/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaModelCloner.java +++ b/archiva-modules/archiva-base/archiva-model/src/main/java/org/apache/maven/archiva/model/ArchivaModelCloner.java @@ -179,6 +179,7 @@ public class ArchivaModelCloner return cloned; } + @SuppressWarnings("unchecked") public static Properties clone( Properties properties ) { if ( properties == null ) @@ -188,7 +189,7 @@ public class ArchivaModelCloner Properties cloned = new Properties(); - Enumeration keys = properties.propertyNames(); + Enumeration keys = (Enumeration) properties.propertyNames(); while ( keys.hasMoreElements() ) { String key = (String) keys.nextElement(); @@ -246,39 +247,34 @@ public class ArchivaModelCloner return cloned; } - public static List cloneArtifactReferences( List artifactReferenceList ) + public static List cloneArtifactReferences( List artifactReferenceList ) { if ( artifactReferenceList == null ) { return null; } - List ret = new ArrayList(); + List ret = new ArrayList(); - Iterator it = artifactReferenceList.iterator(); - while ( it.hasNext() ) + for ( ArtifactReference ref : artifactReferenceList ) { - ArtifactReference artifactReference = (ArtifactReference) it.next(); - ret.add( clone( artifactReference ) ); + ret.add( clone( ref ) ); } return ret; } - public static List cloneDependencies( List dependencies ) + public static List cloneDependencies( List dependencies ) { if ( dependencies == null ) { return null; } - List ret = new ArrayList(); + List ret = new ArrayList(); - Iterator it = dependencies.iterator(); - while ( it.hasNext() ) + for ( Dependency dep : dependencies ) { - Dependency dep = (Dependency) it.next(); - if ( dep == null ) { // Skip null dependency. @@ -291,19 +287,17 @@ public class ArchivaModelCloner return ret; } - public static List cloneExclusions( List exclusions ) + public static List cloneExclusions( List exclusions ) { if ( exclusions == null ) { return null; } - List ret = new ArrayList(); + List ret = new ArrayList(); - Iterator it = exclusions.iterator(); - while ( it.hasNext() ) + for ( Exclusion exclusion : exclusions ) { - Exclusion exclusion = (Exclusion) it.next(); Exclusion cloned = new Exclusion(); cloned.setGroupId( exclusion.getGroupId() ); @@ -315,19 +309,19 @@ public class ArchivaModelCloner return ret; } - public static List cloneIndividuals( List individuals ) + public static List cloneIndividuals( List individuals ) { if ( individuals == null ) { return individuals; } - List ret = new ArrayList(); + List ret = new ArrayList(); - Iterator it = individuals.iterator(); + Iterator it = individuals.iterator(); while ( it.hasNext() ) { - Individual individual = (Individual) it.next(); + Individual individual = it.next(); Individual cloned = new Individual(); cloned.setPrincipal( individual.getPrincipal() ); @@ -348,19 +342,17 @@ public class ArchivaModelCloner return ret; } - public static List cloneLicenses( List licenses ) + public static List cloneLicenses( List licenses ) { if ( licenses == null ) { return null; } - List ret = new ArrayList(); + List ret = new ArrayList(); - Iterator it = licenses.iterator(); - while ( it.hasNext() ) + for ( License license : licenses ) { - License license = (License) it.next(); License cloned = new License(); cloned.setId( license.getId() ); @@ -374,20 +366,17 @@ public class ArchivaModelCloner return ret; } - public static List cloneMailingLists( List mailingLists ) + public static List cloneMailingLists( List mailingLists ) { if ( mailingLists == null ) { return null; } - List ret = new ArrayList(); + List ret = new ArrayList(); - Iterator it = mailingLists.iterator(); - while ( it.hasNext() ) + for ( MailingList mailingList : mailingLists ) { - MailingList mailingList = (MailingList) it.next(); - if ( mailingList == null ) { // Skip null mailing list. @@ -400,29 +389,27 @@ public class ArchivaModelCloner return ret; } - public static List clonePlugins( List plugins ) + public static List clonePlugins( List plugins ) { return cloneArtifactReferences( plugins ); } - public static List cloneReports( List reports ) + public static List cloneReports( List reports ) { return cloneArtifactReferences( reports ); } - public static List cloneRepositories( List repositories ) + public static List cloneRepositories( List repositories ) { if ( repositories == null ) { return null; } - List ret = new ArrayList(); + List ret = new ArrayList(); - Iterator it = repositories.iterator(); - while ( it.hasNext() ) + for ( ProjectRepository repository : repositories ) { - ProjectRepository repository = (ProjectRepository) it.next(); ProjectRepository cloned = new ProjectRepository(); cloned.setId( repository.getId() ); @@ -439,32 +426,29 @@ public class ArchivaModelCloner return ret; } - public static List cloneRoles( List roles ) + public static List cloneRoles( List roles ) { return cloneSimpleStringList( roles ); } - private static List cloneSimpleStringList( List simple ) + private static List cloneSimpleStringList( List simple ) { if ( simple == null ) { return null; } - List ret = new ArrayList(); + List ret = new ArrayList(); - Iterator it = simple.iterator(); - - while ( it.hasNext() ) + for ( String txt : simple ) { - String txt = (String) it.next(); ret.add( txt ); } return ret; } - public static List cloneAvailableVersions( List availableVersions ) + public static List cloneAvailableVersions( List availableVersions ) { return cloneSimpleStringList( availableVersions ); } diff --git a/archiva-modules/archiva-reporting/archiva-metadata-reports/src/main/java/org/apache/maven/archiva/reporting/metadata/MetadataReport.java b/archiva-modules/archiva-reporting/archiva-metadata-reports/src/main/java/org/apache/maven/archiva/reporting/metadata/MetadataReport.java index 0c4a863a2..f651acad6 100644 --- a/archiva-modules/archiva-reporting/archiva-metadata-reports/src/main/java/org/apache/maven/archiva/reporting/metadata/MetadataReport.java +++ b/archiva-modules/archiva-reporting/archiva-metadata-reports/src/main/java/org/apache/maven/archiva/reporting/metadata/MetadataReport.java @@ -24,6 +24,7 @@ import org.apache.maven.archiva.database.ArchivaDatabaseException; import org.apache.maven.archiva.database.Constraint; import org.apache.maven.archiva.database.ObjectNotFoundException; 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.DynamicReportSource; @@ -59,13 +60,13 @@ public class MetadataReport constraint = new RepositoryProblemByTypeConstraint( PROBLEM_TYPE_METADATA ); } - public List getData() + public List getData() throws ObjectNotFoundException, ArchivaDatabaseException { return dao.getRepositoryProblemDAO().queryRepositoryProblems( constraint ); } - public List getData( DataLimits limits ) + public List getData( DataLimits limits ) throws ObjectNotFoundException, ArchivaDatabaseException { // TODO: implement limits.