From 98236b99cb4485f4c81abedf0a60b4d3d4c0d008 Mon Sep 17 00:00:00 2001 From: Martin Stockhammer Date: Sun, 1 Apr 2018 17:21:48 +0200 Subject: [PATCH] Switching to apache commons collections4 --- .../archiva-configuration/pom.xml | 4 ++++ .../DefaultArchivaConfiguration.java | 6 ++--- .../archiva/configuration/FileTypes.java | 4 ++-- .../functors/FiletypeSelectionPredicate.java | 2 +- .../functors/FiletypeToMapClosure.java | 2 +- .../NetworkProxySelectionPredicate.java | 2 +- .../ProxyConnectorSelectionPredicate.java | 2 +- .../archiva-consumer-api/pom.xml | 4 ++-- .../functors/ConsumerWantsFilePredicate.java | 2 +- .../core/AbstractArtifactConsumerTest.java | 2 ++ .../RepositoryPurgeConsumerTest.java | 1 + .../archiva-base/archiva-model/pom.xml | 4 ++-- .../archiva-base/archiva-proxy/pom.xml | 4 ++-- .../DefaultRepositoryProxyConnectors.java | 2 +- .../archiva-repository-admin-api/pom.xml | 4 ++-- .../ProxyConnectorSelectionPredicate.java | 2 +- .../admin/FiletypeToMapClosure.java | 2 +- .../DefaultProxyConnectorAdmin.java | 2 +- .../repository/metadata/MetadataTools.java | 2 +- .../metadata/RepositoryMetadataWriter.java | 2 +- .../scanner/DefaultRepositoryScanner.java | 2 +- .../scanner/RepositoryContentConsumers.java | 23 ++++++++++--------- .../scanner/RepositoryScanStatistics.java | 2 +- .../scanner/RepositoryScannerInstance.java | 21 +++++++++-------- .../functors/ConsumerProcessFileClosure.java | 2 +- .../functors/TriggerBeginScanClosure.java | 2 +- .../functors/TriggerScanCompletedClosure.java | 2 +- .../archiva-base/archiva-xml-tools/pom.xml | 4 ++-- .../archiva/xml/ElementTextListClosure.java | 2 +- .../ArchivaIndexingTaskExecutorTest.java | 2 +- .../DefaultArchivaAdministrationService.java | 7 +++--- .../rest/services/DefaultBrowseService.java | 2 +- .../rest/services/DefaultSearchService.java | 2 +- .../utils/AddAdminRepoConsumerClosure.java | 2 +- .../web/startup/SecuritySynchronization.java | 2 +- .../consumers/DuplicateArtifactsConsumer.java | 2 +- pom.xml | 6 ++--- 37 files changed, 75 insertions(+), 65 deletions(-) diff --git a/archiva-modules/archiva-base/archiva-configuration/pom.xml b/archiva-modules/archiva-base/archiva-configuration/pom.xml index 08675581b..72b129f2c 100644 --- a/archiva-modules/archiva-base/archiva-configuration/pom.xml +++ b/archiva-modules/archiva-base/archiva-configuration/pom.xml @@ -120,6 +120,10 @@ commons-io commons-io + + org.apache.commons + commons-collections4 + org.apache.archiva archiva-policies diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/DefaultArchivaConfiguration.java b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/DefaultArchivaConfiguration.java index caedee308..c19d12f7d 100644 --- a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/DefaultArchivaConfiguration.java +++ b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/DefaultArchivaConfiguration.java @@ -38,9 +38,9 @@ import org.apache.archiva.redback.components.registry.RegistryException; import org.apache.archiva.redback.components.registry.RegistryListener; import org.apache.archiva.redback.components.registry.commons.CommonsConfigurationRegistry; import org.apache.archiva.redback.components.springutils.ComponentContainer; -import org.apache.commons.collections.CollectionUtils; -import org.apache.commons.collections.ListUtils; -import org.apache.commons.collections.MapUtils; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.collections4.ListUtils; +import org.apache.commons.collections4.MapUtils; import org.apache.commons.configuration.BaseConfiguration; import org.apache.commons.io.FileUtils; import org.apache.commons.lang.StringUtils; diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/FileTypes.java b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/FileTypes.java index 655ae69ee..6eae941c4 100644 --- a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/FileTypes.java +++ b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/FileTypes.java @@ -26,8 +26,8 @@ import org.apache.archiva.redback.components.registry.Registry; import org.apache.archiva.redback.components.registry.RegistryException; import org.apache.archiva.redback.components.registry.RegistryListener; import org.apache.archiva.redback.components.registry.commons.CommonsConfigurationRegistry; -import org.apache.commons.collections.CollectionUtils; -import org.apache.commons.collections.Predicate; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.collections4.Predicate; import org.apache.commons.configuration.CombinedConfiguration; import org.apache.tools.ant.types.selectors.SelectorUtils; import org.springframework.stereotype.Service; diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/functors/FiletypeSelectionPredicate.java b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/functors/FiletypeSelectionPredicate.java index ce3d93a52..2fa2d2bf3 100644 --- a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/functors/FiletypeSelectionPredicate.java +++ b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/functors/FiletypeSelectionPredicate.java @@ -20,7 +20,7 @@ package org.apache.archiva.configuration.functors; */ import org.apache.archiva.configuration.FileType; -import org.apache.commons.collections.Predicate; +import org.apache.commons.collections4.Predicate; import org.apache.commons.lang.StringUtils; /** diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/functors/FiletypeToMapClosure.java b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/functors/FiletypeToMapClosure.java index 8d79937f1..ad8ef5c97 100644 --- a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/functors/FiletypeToMapClosure.java +++ b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/functors/FiletypeToMapClosure.java @@ -20,7 +20,7 @@ package org.apache.archiva.configuration.functors; */ import org.apache.archiva.configuration.FileType; -import org.apache.commons.collections.Closure; +import org.apache.commons.collections4.Closure; import java.util.HashMap; import java.util.Map; diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/functors/NetworkProxySelectionPredicate.java b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/functors/NetworkProxySelectionPredicate.java index f3bd35bd5..ddbd6e0e2 100644 --- a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/functors/NetworkProxySelectionPredicate.java +++ b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/functors/NetworkProxySelectionPredicate.java @@ -20,7 +20,7 @@ package org.apache.archiva.configuration.functors; */ import org.apache.archiva.configuration.NetworkProxyConfiguration; -import org.apache.commons.collections.Predicate; +import org.apache.commons.collections4.Predicate; import org.apache.commons.lang.StringUtils; /** diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/functors/ProxyConnectorSelectionPredicate.java b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/functors/ProxyConnectorSelectionPredicate.java index aec7c902f..4cc234a10 100644 --- a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/functors/ProxyConnectorSelectionPredicate.java +++ b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/functors/ProxyConnectorSelectionPredicate.java @@ -20,7 +20,7 @@ package org.apache.archiva.configuration.functors; */ import org.apache.archiva.configuration.ProxyConnectorConfiguration; -import org.apache.commons.collections.Predicate; +import org.apache.commons.collections4.Predicate; import org.apache.commons.lang.StringUtils; /** diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-api/pom.xml b/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-api/pom.xml index 4824291de..abe893b9c 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-api/pom.xml +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-api/pom.xml @@ -42,8 +42,8 @@ archiva-repository-layer - commons-collections - commons-collections + org.apache.commons + commons-collections4 org.apache.ant diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-api/src/main/java/org/apache/archiva/consumers/functors/ConsumerWantsFilePredicate.java b/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-api/src/main/java/org/apache/archiva/consumers/functors/ConsumerWantsFilePredicate.java index b7404e5b9..53267dc13 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-api/src/main/java/org/apache/archiva/consumers/functors/ConsumerWantsFilePredicate.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-consumer-api/src/main/java/org/apache/archiva/consumers/functors/ConsumerWantsFilePredicate.java @@ -23,7 +23,7 @@ import org.apache.archiva.common.utils.BaseFile; import org.apache.archiva.consumers.RepositoryContentConsumer; import org.apache.archiva.repository.ManagedRepository; import org.apache.archiva.repository.features.IndexCreationFeature; -import org.apache.commons.collections.Predicate; +import org.apache.commons.collections4.Predicate; import org.apache.commons.io.FilenameUtils; import org.apache.commons.lang.StringUtils; import org.apache.tools.ant.types.selectors.SelectorUtils; diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/AbstractArtifactConsumerTest.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/AbstractArtifactConsumerTest.java index dae8575e4..4d50b8ce0 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/AbstractArtifactConsumerTest.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/AbstractArtifactConsumerTest.java @@ -68,6 +68,7 @@ public abstract class AbstractArtifactConsumerTest } + @SuppressWarnings( "deprecation" ) @Test public void testConsumption() { @@ -81,6 +82,7 @@ public abstract class AbstractArtifactConsumerTest assertFalse( predicate.evaluate( consumer ) ); } + @SuppressWarnings( "deprecation" ) @Test public void testConsumptionOfOtherMetadata() { diff --git a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/RepositoryPurgeConsumerTest.java b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/RepositoryPurgeConsumerTest.java index 65047eeb0..9ad64bd47 100644 --- a/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/RepositoryPurgeConsumerTest.java +++ b/archiva-modules/archiva-base/archiva-consumers/archiva-core-consumers/src/test/java/org/apache/archiva/consumers/core/repository/RepositoryPurgeConsumerTest.java @@ -108,6 +108,7 @@ public class RepositoryPurgeConsumerTest fileType.removePattern( "**/*.xml" ); } + @SuppressWarnings( "deprecation" ) private void assertNotConsumed( String path ) throws Exception { diff --git a/archiva-modules/archiva-base/archiva-model/pom.xml b/archiva-modules/archiva-base/archiva-model/pom.xml index 93e3e9ad6..071268cd1 100755 --- a/archiva-modules/archiva-base/archiva-model/pom.xml +++ b/archiva-modules/archiva-base/archiva-model/pom.xml @@ -34,8 +34,8 @@ commons-lang - commons-collections - commons-collections + org.apache.commons + commons-collections4 org.apache.archiva diff --git a/archiva-modules/archiva-base/archiva-proxy/pom.xml b/archiva-modules/archiva-base/archiva-proxy/pom.xml index 85a3e6080..dca7a31b9 100644 --- a/archiva-modules/archiva-base/archiva-proxy/pom.xml +++ b/archiva-modules/archiva-base/archiva-proxy/pom.xml @@ -94,8 +94,8 @@ commons-lang - commons-collections - commons-collections + org.apache.commons + commons-collections4 org.apache.ant diff --git a/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/DefaultRepositoryProxyConnectors.java b/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/DefaultRepositoryProxyConnectors.java index a68f01dcc..ebb5463a3 100644 --- a/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/DefaultRepositoryProxyConnectors.java +++ b/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/archiva/proxy/DefaultRepositoryProxyConnectors.java @@ -65,7 +65,7 @@ import org.apache.archiva.repository.metadata.MetadataTools; import org.apache.archiva.repository.metadata.RepositoryMetadataException; import org.apache.archiva.scheduler.ArchivaTaskScheduler; import org.apache.archiva.scheduler.repository.model.RepositoryTask; -import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.io.FilenameUtils; import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.SystemUtils; diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/pom.xml b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/pom.xml index bf2868c42..33ee7b130 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/pom.xml +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/pom.xml @@ -34,8 +34,8 @@ archiva-repository-layer - commons-collections - commons-collections + org.apache.commons + commons-collections4 commons-lang diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/proxyconnector/ProxyConnectorSelectionPredicate.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/proxyconnector/ProxyConnectorSelectionPredicate.java index 4ae147a24..b9601e557 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/proxyconnector/ProxyConnectorSelectionPredicate.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-api/src/main/java/org/apache/archiva/admin/model/proxyconnector/ProxyConnectorSelectionPredicate.java @@ -19,7 +19,7 @@ package org.apache.archiva.admin.model.proxyconnector; */ import org.apache.archiva.admin.model.beans.ProxyConnector; -import org.apache.commons.collections.Predicate; +import org.apache.commons.collections4.Predicate; import org.apache.commons.lang.StringUtils; /** diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/admin/FiletypeToMapClosure.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/admin/FiletypeToMapClosure.java index 57e924e25..de5dc6fca 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/admin/FiletypeToMapClosure.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/admin/FiletypeToMapClosure.java @@ -20,7 +20,7 @@ package org.apache.archiva.admin.repository.admin; */ import org.apache.archiva.admin.model.beans.FileType; -import org.apache.commons.collections.Closure; +import org.apache.commons.collections4.Closure; import java.util.HashMap; import java.util.Map; diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/proxyconnector/DefaultProxyConnectorAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/proxyconnector/DefaultProxyConnectorAdmin.java index 38d2b7ef8..52943c1c0 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/proxyconnector/DefaultProxyConnectorAdmin.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/proxyconnector/DefaultProxyConnectorAdmin.java @@ -29,7 +29,7 @@ import org.apache.archiva.configuration.ProxyConnectorConfiguration; import org.apache.archiva.configuration.functors.ProxyConnectorSelectionPredicate; import org.apache.archiva.metadata.model.facets.AuditEvent; import org.apache.archiva.repository.RepositoryRegistry; -import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang.StringUtils; import org.springframework.stereotype.Service; diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/metadata/MetadataTools.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/metadata/MetadataTools.java index 9bfcc2676..4444e7cce 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/metadata/MetadataTools.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/metadata/MetadataTools.java @@ -43,7 +43,7 @@ import org.apache.archiva.repository.LayoutException; import org.apache.archiva.repository.ManagedRepositoryContent; import org.apache.archiva.repository.RemoteRepositoryContent; import org.apache.archiva.xml.XMLException; -import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.math.NumberUtils; import org.apache.commons.lang.time.DateUtils; diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/metadata/RepositoryMetadataWriter.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/metadata/RepositoryMetadataWriter.java index 0e553f634..4585d59ff 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/metadata/RepositoryMetadataWriter.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/archiva/repository/metadata/RepositoryMetadataWriter.java @@ -24,7 +24,7 @@ import org.apache.archiva.model.ArchivaRepositoryMetadata; import org.apache.archiva.model.Plugin; import org.apache.archiva.xml.XMLException; import org.apache.archiva.xml.XMLWriter; -import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang.StringUtils; import org.dom4j.Document; import org.dom4j.DocumentHelper; diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/DefaultRepositoryScanner.java b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/DefaultRepositoryScanner.java index 7e080158d..8df894ee6 100644 --- a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/DefaultRepositoryScanner.java +++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/DefaultRepositoryScanner.java @@ -25,7 +25,7 @@ import org.apache.archiva.consumers.InvalidRepositoryContentConsumer; import org.apache.archiva.consumers.KnownRepositoryContentConsumer; import org.apache.archiva.consumers.RepositoryContentConsumer; import org.apache.archiva.repository.ManagedRepository; -import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.collections4.CollectionUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryContentConsumers.java b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryContentConsumers.java index c03c5d111..b561c112b 100644 --- a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryContentConsumers.java +++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryContentConsumers.java @@ -32,9 +32,10 @@ import org.apache.archiva.repository.ManagedRepository; import org.apache.archiva.repository.scanner.functors.ConsumerProcessFileClosure; import org.apache.archiva.repository.scanner.functors.TriggerBeginScanClosure; import org.apache.archiva.repository.scanner.functors.TriggerScanCompletedClosure; -import org.apache.commons.collections.Closure; -import org.apache.commons.collections.CollectionUtils; -import org.apache.commons.collections.functors.IfClosure; +import org.apache.commons.collections4.Closure; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.collections4.IterableUtils; +import org.apache.commons.collections4.functors.IfClosure; import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; @@ -296,8 +297,8 @@ public class RepositoryContentConsumers } List selectedInvalidConsumers = getSelectedInvalidConsumers(); - CollectionUtils.forAllDo( selectedKnownConsumers, triggerBeginScan ); - CollectionUtils.forAllDo( selectedInvalidConsumers, triggerBeginScan ); + IterableUtils.forEach( selectedKnownConsumers, triggerBeginScan ); + IterableUtils.forEach( selectedInvalidConsumers, triggerBeginScan ); // yuck. In case you can't read this, it says // "process the file if the consumer has it in the includes list, and not in the excludes list" @@ -311,25 +312,25 @@ public class RepositoryContentConsumers closure.setBasefile( baseFile ); closure.setExecuteOnEntireRepo( false ); - Closure processIfWanted = IfClosure.getInstance( predicate, closure ); + Closure processIfWanted = IfClosure.ifClosure( predicate, closure ); - CollectionUtils.forAllDo( selectedKnownConsumers, processIfWanted ); + IterableUtils.forEach( selectedKnownConsumers, processIfWanted ); if ( predicate.getWantedFileCount() <= 0 ) { // Nothing known processed this file. It is invalid! - CollectionUtils.forAllDo( selectedInvalidConsumers, closure ); + IterableUtils.forEach( selectedInvalidConsumers, closure ); } TriggerScanCompletedClosure scanCompletedClosure = new TriggerScanCompletedClosure( repository, false ); - CollectionUtils.forAllDo( selectedKnownConsumers, scanCompletedClosure ); + IterableUtils.forEach( selectedKnownConsumers, scanCompletedClosure ); } finally { /* TODO: This is never called by the repository scanner instance, so not calling here either - but it probably should be? - CollectionUtils.forAllDo( availableKnownConsumers, triggerCompleteScan ); - CollectionUtils.forAllDo( availableInvalidConsumers, triggerCompleteScan ); + IterableUtils.forEach( availableKnownConsumers, triggerCompleteScan ); + IterableUtils.forEach( availableInvalidConsumers, triggerCompleteScan ); */ releaseSelectedKnownConsumers( selectedKnownConsumers ); } diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScanStatistics.java b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScanStatistics.java index 1d9ebbeeb..7c915cabb 100644 --- a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScanStatistics.java +++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScanStatistics.java @@ -20,7 +20,7 @@ package org.apache.archiva.repository.scanner; */ import org.apache.archiva.repository.ManagedRepository; -import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.collections4.CollectionUtils; import javax.xml.bind.annotation.XmlRootElement; import java.text.SimpleDateFormat; diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScannerInstance.java b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScannerInstance.java index 6d2616696..cbe66d75f 100644 --- a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScannerInstance.java +++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/RepositoryScannerInstance.java @@ -28,9 +28,10 @@ import org.apache.archiva.repository.ManagedRepository; import org.apache.archiva.repository.scanner.functors.ConsumerProcessFileClosure; import org.apache.archiva.repository.scanner.functors.TriggerBeginScanClosure; import org.apache.archiva.repository.scanner.functors.TriggerScanCompletedClosure; -import org.apache.commons.collections.Closure; -import org.apache.commons.collections.CollectionUtils; -import org.apache.commons.collections.functors.IfClosure; +import org.apache.commons.collections4.Closure; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.collections4.IterableUtils; +import org.apache.commons.collections4.functors.IfClosure; import org.apache.commons.lang.SystemUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -120,8 +121,8 @@ public class RepositoryScannerInstance Closure triggerBeginScan = new TriggerBeginScanClosure( repository, new Date( System.currentTimeMillis() ), true ); - CollectionUtils.forAllDo( knownConsumerList, triggerBeginScan ); - CollectionUtils.forAllDo( invalidConsumerList, triggerBeginScan ); + IterableUtils.forEach( knownConsumerList, triggerBeginScan ); + IterableUtils.forEach( invalidConsumerList, triggerBeginScan ); if ( SystemUtils.IS_OS_WINDOWS ) { @@ -239,13 +240,13 @@ public class RepositoryScannerInstance consumerProcessFile.setBasefile( basefile ); consumerWantsFile.setBasefile( basefile ); - Closure processIfWanted = IfClosure.getInstance( consumerWantsFile, consumerProcessFile ); - CollectionUtils.forAllDo( this.knownConsumers, processIfWanted ); + Closure processIfWanted = IfClosure.ifClosure( consumerWantsFile, consumerProcessFile ); + IterableUtils.forEach( this.knownConsumers, processIfWanted ); if ( consumerWantsFile.getWantedFileCount() <= 0 ) { // Nothing known processed this file. It is invalid! - CollectionUtils.forAllDo( this.invalidConsumers, consumerProcessFile ); + IterableUtils.forEach( this.invalidConsumers, consumerProcessFile ); } } @@ -272,8 +273,8 @@ public class RepositoryScannerInstance private void finishWalk() { this.isRunning = false; TriggerScanCompletedClosure scanCompletedClosure = new TriggerScanCompletedClosure( repository, true ); - CollectionUtils.forAllDo( knownConsumers, scanCompletedClosure ); - CollectionUtils.forAllDo( invalidConsumers, scanCompletedClosure ); + IterableUtils.forEach( knownConsumers, scanCompletedClosure ); + IterableUtils.forEach( invalidConsumers, scanCompletedClosure ); stats.setConsumerTimings( consumerTimings ); stats.setConsumerCounts( consumerCounts ); diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/ConsumerProcessFileClosure.java b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/ConsumerProcessFileClosure.java index a6e5f7739..6cd9b21cf 100644 --- a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/ConsumerProcessFileClosure.java +++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/ConsumerProcessFileClosure.java @@ -21,7 +21,7 @@ package org.apache.archiva.repository.scanner.functors; import org.apache.archiva.common.utils.BaseFile; import org.apache.archiva.consumers.RepositoryContentConsumer; -import org.apache.commons.collections.Closure; +import org.apache.commons.collections4.Closure; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/TriggerBeginScanClosure.java b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/TriggerBeginScanClosure.java index b1e164bc6..8bd6d8e9a 100644 --- a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/TriggerBeginScanClosure.java +++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/TriggerBeginScanClosure.java @@ -22,7 +22,7 @@ package org.apache.archiva.repository.scanner.functors; import org.apache.archiva.consumers.ConsumerException; import org.apache.archiva.consumers.RepositoryContentConsumer; import org.apache.archiva.repository.ManagedRepository; -import org.apache.commons.collections.Closure; +import org.apache.commons.collections4.Closure; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/TriggerScanCompletedClosure.java b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/TriggerScanCompletedClosure.java index d14af6917..79909f8f9 100644 --- a/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/TriggerScanCompletedClosure.java +++ b/archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/functors/TriggerScanCompletedClosure.java @@ -21,7 +21,7 @@ package org.apache.archiva.repository.scanner.functors; import org.apache.archiva.consumers.RepositoryContentConsumer; import org.apache.archiva.repository.ManagedRepository; -import org.apache.commons.collections.Closure; +import org.apache.commons.collections4.Closure; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/archiva-modules/archiva-base/archiva-xml-tools/pom.xml b/archiva-modules/archiva-base/archiva-xml-tools/pom.xml index b91c663bb..190beb869 100644 --- a/archiva-modules/archiva-base/archiva-xml-tools/pom.xml +++ b/archiva-modules/archiva-base/archiva-xml-tools/pom.xml @@ -34,8 +34,8 @@ archiva-common - commons-collections - commons-collections + org.apache.commons + commons-collections4 commons-io diff --git a/archiva-modules/archiva-base/archiva-xml-tools/src/main/java/org/apache/archiva/xml/ElementTextListClosure.java b/archiva-modules/archiva-base/archiva-xml-tools/src/main/java/org/apache/archiva/xml/ElementTextListClosure.java index 80a815588..10adbd85c 100644 --- a/archiva-modules/archiva-base/archiva-xml-tools/src/main/java/org/apache/archiva/xml/ElementTextListClosure.java +++ b/archiva-modules/archiva-base/archiva-xml-tools/src/main/java/org/apache/archiva/xml/ElementTextListClosure.java @@ -19,7 +19,7 @@ package org.apache.archiva.xml; * under the License. */ -import org.apache.commons.collections.Closure; +import org.apache.commons.collections4.Closure; import org.dom4j.Element; import java.util.ArrayList; diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/java/org/apache/archiva/scheduler/indexing/ArchivaIndexingTaskExecutorTest.java b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/java/org/apache/archiva/scheduler/indexing/ArchivaIndexingTaskExecutorTest.java index 719a19aa1..5c3f3bc7e 100644 --- a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/java/org/apache/archiva/scheduler/indexing/ArchivaIndexingTaskExecutorTest.java +++ b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/test/java/org/apache/archiva/scheduler/indexing/ArchivaIndexingTaskExecutorTest.java @@ -157,7 +157,7 @@ public class ArchivaIndexingTaskExecutorTest assertTrue( Files.exists(basePath.resolve( ".indexer" )) ); assertTrue( Files.exists(basePath.resolve(".index" )) ); - assertEquals( 1, response.getTotalHits() ); + assertEquals( 1, response.getTotalHitsCount()); Set results = response.getResults(); diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultArchivaAdministrationService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultArchivaAdministrationService.java index ff1d3fd18..56235d6f6 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultArchivaAdministrationService.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultArchivaAdministrationService.java @@ -31,7 +31,8 @@ import org.apache.archiva.rest.api.services.ArchivaAdministrationService; import org.apache.archiva.rest.api.services.ArchivaRestServiceException; import org.apache.archiva.rest.services.utils.AddAdminRepoConsumerClosure; import org.apache.archiva.rest.services.utils.AdminRepositoryConsumerComparator; -import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.collections4.IterableUtils; import org.apache.commons.lang.StringUtils; import org.springframework.stereotype.Service; @@ -412,7 +413,7 @@ public class DefaultArchivaAdministrationService { AddAdminRepoConsumerClosure addAdminRepoConsumer = new AddAdminRepoConsumerClosure( archivaAdministration.getKnownContentConsumers() ); - CollectionUtils.forAllDo( repoConsumerUtil.getAvailableKnownConsumers(), addAdminRepoConsumer ); + IterableUtils.forEach( repoConsumerUtil.getAvailableKnownConsumers(), addAdminRepoConsumer ); List knownContentConsumers = addAdminRepoConsumer.getList(); Collections.sort( knownContentConsumers, AdminRepositoryConsumerComparator.getInstance() ); return knownContentConsumers; @@ -431,7 +432,7 @@ public class DefaultArchivaAdministrationService { AddAdminRepoConsumerClosure addAdminRepoConsumer = new AddAdminRepoConsumerClosure( archivaAdministration.getInvalidContentConsumers() ); - CollectionUtils.forAllDo( repoConsumerUtil.getAvailableInvalidConsumers(), addAdminRepoConsumer ); + IterableUtils.forEach( repoConsumerUtil.getAvailableInvalidConsumers(), addAdminRepoConsumer ); List invalidContentConsumers = addAdminRepoConsumer.getList(); Collections.sort( invalidContentConsumers, AdminRepositoryConsumerComparator.getInstance() ); return invalidContentConsumers; diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultBrowseService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultBrowseService.java index 55cfbf5ec..0e3a77735 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultBrowseService.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultBrowseService.java @@ -58,7 +58,7 @@ import org.apache.archiva.rest.api.services.BrowseService; import org.apache.archiva.rest.services.utils.ArtifactContentEntryComparator; import org.apache.archiva.security.ArchivaSecurityException; import org.apache.archiva.xml.XMLException; -import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.io.IOUtils; import org.apache.commons.lang.StringUtils; import org.springframework.stereotype.Service; diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultSearchService.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultSearchService.java index 68631041e..7a12256ca 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultSearchService.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/DefaultSearchService.java @@ -38,7 +38,7 @@ import org.apache.archiva.rest.api.model.SearchRequest; import org.apache.archiva.rest.api.model.StringList; import org.apache.archiva.rest.api.services.ArchivaRestServiceException; import org.apache.archiva.rest.api.services.SearchService; -import org.apache.commons.collections.ListUtils; +import org.apache.commons.collections4.ListUtils; import org.apache.commons.lang.StringUtils; import org.springframework.stereotype.Service; diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/utils/AddAdminRepoConsumerClosure.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/utils/AddAdminRepoConsumerClosure.java index 77de7a0d5..b757819f8 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/utils/AddAdminRepoConsumerClosure.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/main/java/org/apache/archiva/rest/services/utils/AddAdminRepoConsumerClosure.java @@ -21,7 +21,7 @@ package org.apache.archiva.rest.services.utils; import org.apache.archiva.consumers.RepositoryContentConsumer; import org.apache.archiva.rest.api.model.AdminRepositoryConsumer; -import org.apache.commons.collections.Closure; +import org.apache.commons.collections4.Closure; import java.util.ArrayList; import java.util.List; diff --git a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/startup/SecuritySynchronization.java b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/startup/SecuritySynchronization.java index 931cab4d1..4428130fc 100644 --- a/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/startup/SecuritySynchronization.java +++ b/archiva-modules/archiva-web/archiva-web-common/src/main/java/org/apache/archiva/web/startup/SecuritySynchronization.java @@ -32,7 +32,7 @@ import org.apache.archiva.redback.role.RoleManagerException; import org.apache.archiva.redback.system.check.EnvironmentCheck; import org.apache.archiva.redback.users.UserManager; import org.apache.archiva.security.common.ArchivaRoleConstants; -import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.time.StopWatch; import org.slf4j.Logger; diff --git a/archiva-modules/plugins/problem-reports/src/main/java/org/apache/archiva/reports/consumers/DuplicateArtifactsConsumer.java b/archiva-modules/plugins/problem-reports/src/main/java/org/apache/archiva/reports/consumers/DuplicateArtifactsConsumer.java index ea8e06315..95c5ac3d2 100644 --- a/archiva-modules/plugins/problem-reports/src/main/java/org/apache/archiva/reports/consumers/DuplicateArtifactsConsumer.java +++ b/archiva-modules/plugins/problem-reports/src/main/java/org/apache/archiva/reports/consumers/DuplicateArtifactsConsumer.java @@ -37,7 +37,7 @@ import org.apache.archiva.metadata.repository.storage.RepositoryPathTranslator; import org.apache.archiva.redback.components.registry.Registry; import org.apache.archiva.redback.components.registry.RegistryListener; import org.apache.archiva.repository.ManagedRepository; -import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.collections4.CollectionUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.context.annotation.Scope; diff --git a/pom.xml b/pom.xml index 33f8dcb9a..d177f345a 100644 --- a/pom.xml +++ b/pom.xml @@ -49,7 +49,7 @@ 1.6 - 3.2.1 + 4.1 1.2.2 2.5 2.6 @@ -699,8 +699,8 @@ - commons-collections - commons-collections + org.apache.commons + commons-collections4 ${commons-collections.version} -- 2.39.5