diff options
author | Olivier Lamy <olamy@apache.org> | 2012-03-09 22:35:55 +0000 |
---|---|---|
committer | Olivier Lamy <olamy@apache.org> | 2012-03-09 22:35:55 +0000 |
commit | 4fddb75e9b8143e9de4fdca163ff4d88be361036 (patch) | |
tree | fd0445e3b097d2b72740d3f49ee681861f449bbc /archiva-modules/archiva-base/archiva-repository-scanner | |
parent | 64be7b17c0f87a4dc3b1b2c4c501064346649332 (diff) | |
download | archiva-4fddb75e9b8143e9de4fdca163ff4d88be361036.tar.gz archiva-4fddb75e9b8143e9de4fdca163ff4d88be361036.zip |
ensure we remove scannerInstance from the queue in a finally block, minor javascript cleanup
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1299081 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/archiva-base/archiva-repository-scanner')
-rw-r--r-- | archiva-modules/archiva-base/archiva-repository-scanner/src/main/java/org/apache/archiva/repository/scanner/DefaultRepositoryScanner.java | 24 |
1 files changed, 15 insertions, 9 deletions
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 b20786947..469321de5 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 @@ -21,11 +21,11 @@ package org.apache.archiva.repository.scanner; import org.apache.archiva.admin.model.RepositoryAdminException; import org.apache.archiva.admin.model.beans.ManagedRepository; -import org.apache.commons.collections.CollectionUtils; import org.apache.archiva.configuration.FileTypes; import org.apache.archiva.consumers.InvalidRepositoryContentConsumer; import org.apache.archiva.consumers.KnownRepositoryContentConsumer; import org.apache.archiva.consumers.RepositoryContentConsumer; +import org.apache.commons.collections.CollectionUtils; import org.codehaus.plexus.util.DirectoryWalker; import org.springframework.stereotype.Service; @@ -130,17 +130,23 @@ public class DefaultRepositoryScanner inProgressScans.add( scannerInstance ); - dirWalker.addDirectoryWalkListener( scannerInstance ); - - // Execute scan. - dirWalker.scan(); + RepositoryScanStatistics stats; + try + { + dirWalker.addDirectoryWalkListener( scannerInstance ); - RepositoryScanStatistics stats = scannerInstance.getStatistics(); + // Execute scan. + dirWalker.scan(); - stats.setKnownConsumers( gatherIds( knownContentConsumers ) ); - stats.setInvalidConsumers( gatherIds( invalidContentConsumers ) ); + stats = scannerInstance.getStatistics(); - inProgressScans.remove( scannerInstance ); + stats.setKnownConsumers( gatherIds( knownContentConsumers ) ); + stats.setInvalidConsumers( gatherIds( invalidContentConsumers ) ); + } + finally + { + inProgressScans.remove( scannerInstance ); + } return stats; } |