From 01fd2d285abb93d9ddf75eab09bca43d2404c46a Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Mon, 2 Apr 2012 15:02:12 +0000 Subject: [PATCH] avoid creating temp directory in repository directory git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1308376 13f79535-47bb-0310-9956-ffa450edef68 --- .../proxy/DefaultRepositoryProxyConnectors.java | 13 ------------- archiva-modules/plugins/maven2-repository/pom.xml | 1 + .../storage/maven2/RepositoryModelResolver.java | 13 ++----------- 3 files changed, 3 insertions(+), 24 deletions(-) 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 d51afc5ae..d9d615426 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 @@ -1009,19 +1009,6 @@ public class DefaultRepositoryProxyConnectors */ private File createWorkingDirectory( ManagedRepositoryContent repository ) { - // TODO: This is ugly - lets actually clean this up when we get the new repository api - /* - try - { - File tmpDir = File.createTempFile( ".workingdirectory", null ); - tmpDir.delete(); - tmpDir.mkdirs(); - return tmpDir; - } - catch ( IOException e ) - { - throw new RuntimeException( "Could not create working directory for this request", e ); - } */ return Files.createTempDir(); } diff --git a/archiva-modules/plugins/maven2-repository/pom.xml b/archiva-modules/plugins/maven2-repository/pom.xml index 157257c46..47de02dea 100644 --- a/archiva-modules/plugins/maven2-repository/pom.xml +++ b/archiva-modules/plugins/maven2-repository/pom.xml @@ -200,6 +200,7 @@ org.apache.maven.index*, org.apache.maven.wagon*, org.codehaus.plexus*, + com.google.common.io, org.codehaus.redback.components*, org.dom4j*;version="[1.6,2)", org.springframework*;version="[3,4)", diff --git a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/RepositoryModelResolver.java b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/RepositoryModelResolver.java index d3dc6e969..946e2f610 100644 --- a/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/RepositoryModelResolver.java +++ b/archiva-modules/plugins/maven2-repository/src/main/java/org/apache/archiva/metadata/repository/storage/maven2/RepositoryModelResolver.java @@ -19,6 +19,7 @@ package org.apache.archiva.metadata.repository.storage.maven2; * under the License. */ +import com.google.common.io.Files; import org.apache.archiva.admin.model.beans.ManagedRepository; import org.apache.archiva.admin.model.beans.NetworkProxy; import org.apache.archiva.admin.model.beans.RemoteRepository; @@ -424,17 +425,7 @@ public class RepositoryModelResolver private File createWorkingDirectory( String targetRepository ) { - try - { - File tmpDir = File.createTempFile( ".workingdirectory", null, new File( targetRepository ) ); - tmpDir.delete(); - tmpDir.mkdirs(); - return tmpDir; - } - catch ( IOException e ) - { - throw new RuntimeException( "Could not create working directory for this request", e ); - } + return Files.createTempDir(); } private void moveFileIfExists( File fileToMove, File directory ) -- 2.39.5