diff options
author | Olivier Lamy <olamy@apache.org> | 2011-10-01 14:21:14 +0000 |
---|---|---|
committer | Olivier Lamy <olamy@apache.org> | 2011-10-01 14:21:14 +0000 |
commit | 5ff3b3085610487761198a71ecd72ba6b5db20b9 (patch) | |
tree | b171d7d4787c88571b271541cb774bfcf92cb7b8 /archiva-modules/archiva-scheduler | |
parent | d8972640dc5673a7c3866e760d4f196a2e9e7a70 (diff) | |
download | archiva-5ff3b3085610487761198a71ecd72ba6b5db20b9.tar.gz archiva-5ff3b3085610487761198a71ecd72ba6b5db20b9.zip |
ensure we correctly delete temporary download directory
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1177991 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-modules/archiva-scheduler')
-rw-r--r-- | archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/DownloadRemoteIndexTask.java | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/DownloadRemoteIndexTask.java b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/DownloadRemoteIndexTask.java index b334449f5..021b55a23 100644 --- a/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/DownloadRemoteIndexTask.java +++ b/archiva-modules/archiva-scheduler/archiva-scheduler-indexing/src/main/java/org/apache/archiva/scheduler/indexing/DownloadRemoteIndexTask.java @@ -116,6 +116,8 @@ public class DownloadRemoteIndexTask // create a temp directory to download files final File tempIndexDirectory = new File( indexingContext.getIndexDirectoryFile( ).getParent( ), ".tmpIndex" ); + File indexCacheDirectory = new File( indexingContext.getIndexDirectoryFile( ).getParent( ), ".indexCache" ); + indexCacheDirectory.mkdirs(); try { if ( tempIndexDirectory.exists( ) ) @@ -123,6 +125,7 @@ public class DownloadRemoteIndexTask FileUtils.deleteDirectory( tempIndexDirectory ); } tempIndexDirectory.mkdirs( ); + tempIndexDirectory.deleteOnExit(); String baseIndexUrl = indexingContext.getIndexUpdateUrl( ); final Wagon wagon = wagonFactory.getWagon( new URL( this.remoteRepository.getUrl( ) ).getProtocol( ) ); @@ -174,14 +177,13 @@ public class DownloadRemoteIndexTask { try { - log.debug( "resourceFetcher#retrieve, name:{}", name ); - //TODO check those files are deleted !! + log.info( "index update retrieve file, name:{}", name ); File file = new File( tempIndexDirectory, name ); if ( file.exists( ) ) { file.delete( ); } - //file.deleteOnExit(); + file.deleteOnExit(); wagon.get( name, file ); return new FileInputStream( file ); } @@ -202,6 +204,7 @@ public class DownloadRemoteIndexTask IndexUpdateRequest request = new IndexUpdateRequest( indexingContext, resourceFetcher ); request.setForceFullUpdate( this.fullDownload ); + request.setLocalIndexCacheDir( indexCacheDirectory ); this.indexUpdater.fetchAndUpdateIndex( request ); stopWatch.stop( ); |