aboutsummaryrefslogtreecommitdiffstats
path: root/archiva-modules/archiva-web/archiva-webdav
diff options
context:
space:
mode:
authorOlivier Lamy <olamy@apache.org>2014-04-16 17:36:01 +1000
committerOlivier Lamy <olamy@apache.org>2014-04-16 17:36:01 +1000
commit767e00c182085b193c9f2481a815e90c5c054095 (patch)
tree9abbd1c82b82718acf3373bb719d3f38f7667ee5 /archiva-modules/archiva-web/archiva-webdav
parent67985e0486f4c0d4fb65ca0859201d70e91703b5 (diff)
downloadarchiva-767e00c182085b193c9f2481a815e90c5c054095.tar.gz
archiva-767e00c182085b193c9f2481a815e90c5c054095.zip
use Files from java.nio
Diffstat (limited to 'archiva-modules/archiva-web/archiva-webdav')
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java7
-rw-r--r--archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletProxiedTestCase.java16
2 files changed, 12 insertions, 11 deletions
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java
index b252fe302..21865cafa 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/main/java/org/apache/archiva/webdav/ArchivaDavResourceFactory.java
@@ -19,7 +19,6 @@ package org.apache.archiva.webdav;
* under the License.
*/
-import com.google.common.io.Files;
import org.apache.archiva.admin.model.RepositoryAdminException;
import org.apache.archiva.admin.model.beans.ManagedRepository;
import org.apache.archiva.admin.model.beans.RemoteRepository;
@@ -106,6 +105,7 @@ import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.File;
import java.io.IOException;
+import java.nio.file.Files;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
@@ -1343,7 +1343,7 @@ public class ArchivaDavResourceFactory
log.info( "generate temporary merged index for repository group '{}' for repositories '{}'",
repositoryGroupConfiguration.getId(), authzRepos );
- File tempRepoFile = Files.createTempDir();
+ File tempRepoFile = Files.createTempDirectory("temp").toFile();
tempRepoFile.deleteOnExit();
IndexMergerRequest indexMergerRequest =
@@ -1376,6 +1376,9 @@ public class ArchivaDavResourceFactory
catch ( IndexMergerException e )
{
throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e );
+ } catch ( IOException e )
+ {
+ throw new DavException( HttpServletResponse.SC_INTERNAL_SERVER_ERROR, e );
}
}
diff --git a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletProxiedTestCase.java b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletProxiedTestCase.java
index c38e33f54..3d8a5e6dc 100644
--- a/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletProxiedTestCase.java
+++ b/archiva-modules/archiva-web/archiva-webdav/src/test/java/org/apache/archiva/webdav/AbstractRepositoryServletProxiedTestCase.java
@@ -21,9 +21,6 @@ package org.apache.archiva.webdav;
import com.gargoylesoftware.htmlunit.WebClient;
-import com.gargoylesoftware.htmlunit.WebRequest;
-import com.gargoylesoftware.htmlunit.WebResponse;
-import com.google.common.io.Files;
import org.apache.archiva.configuration.ProxyConnectorConfiguration;
import org.apache.archiva.configuration.RemoteRepositoryConfiguration;
import org.apache.archiva.policies.CachedFailuresPolicy;
@@ -36,17 +33,18 @@ import org.eclipse.jetty.server.handler.ContextHandlerCollection;
import org.eclipse.jetty.servlet.DefaultServlet;
import org.eclipse.jetty.servlet.ServletContextHandler;
import org.eclipse.jetty.servlet.ServletHolder;
-import static org.assertj.core.api.Assertions.assertThat;
import org.junit.After;
import org.junit.Before;
import javax.servlet.http.HttpServletResponse;
import java.io.File;
import java.nio.charset.Charset;
+import java.nio.file.Files;
+
+import static org.assertj.core.api.Assertions.assertThat;
/**
* AbstractRepositoryServletProxiedTestCase
- *
*/
public abstract class AbstractRepositoryServletProxiedTestCase
extends AbstractRepositoryServletTestCase
@@ -121,7 +119,8 @@ public abstract class AbstractRepositoryServletProxiedTestCase
RemoteRepoInfo repo = new RemoteRepoInfo();
repo.id = id;
repo.context = "/" + id;
- repo.root = Files.createTempDir();// new File( System.getProperty( "basedir" ) + "target/remote-repos/" + id + "/" );
+ repo.root = Files.createTempDirectory(
+ "temp" ).toFile();// new File( System.getProperty( "basedir" ) + "target/remote-repos/" + id + "/" );
// Remove exising root contents.
if ( repo.root.exists() )
@@ -213,12 +212,12 @@ public abstract class AbstractRepositoryServletProxiedTestCase
throws Exception
{
File destFile = new File( remoteRepo.root, path );
- if (destFile.exists())
+ if ( destFile.exists() )
{
destFile.delete();
}
destFile.getParentFile().mkdirs();
- FileUtils.writeStringToFile( destFile, contents, Charset.defaultCharset() );
+ FileUtils.writeStringToFile( destFile, contents, Charset.defaultCharset() );
return destFile;
}
@@ -260,7 +259,6 @@ public abstract class AbstractRepositoryServletProxiedTestCase
{
remoteSnapshots = createServer( "snapshots" );
-
assertServerSetupCorrectly( remoteSnapshots );
RemoteRepositoryConfiguration remoteRepositoryConfiguration =
archivaConfiguration.getConfiguration().getRemoteRepositoriesAsMap().get( remoteSnapshots.id );