From 63964ffef4f608d610b621337e32ed1aace36d91 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Fri, 17 Feb 2012 11:36:20 +0000 Subject: [PATCH] [MRM-1606] Upgrade to wagon 2.2. git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1245404 13f79535-47bb-0310-9956-ffa450edef68 --- .../DefaultRepositoryProxyConnectors.java | 4 +++- .../indexing/DownloadRemoteIndexTask.java | 24 ++++--------------- .../maven2/RepositoryModelResolver.java | 3 ++- pom.xml | 2 +- 4 files changed, 10 insertions(+), 23 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 cbdd6948c..d0db565f1 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 @@ -1109,7 +1109,9 @@ public class DefaultRepositoryProxyConnectors // Convert seconds to milliseconds int timeoutInMilliseconds = remoteRepository.getRepository().getTimeout() * 1000; - // Set timeout + // Set timeout read and connect + // FIXME olamy having 2 config values + wagon.setReadTimeout( timeoutInMilliseconds ); wagon.setTimeout( timeoutInMilliseconds ); try 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 c9553082d..b348ab2f4 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 @@ -41,8 +41,6 @@ import org.apache.maven.wagon.events.TransferEvent; import org.apache.maven.wagon.events.TransferListener; import org.apache.maven.wagon.proxy.ProxyInfo; import org.apache.maven.wagon.repository.Repository; -import org.apache.maven.wagon.shared.http.HttpConfiguration; -import org.apache.maven.wagon.shared.http.HttpMethodConfiguration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -51,7 +49,6 @@ import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; -import java.lang.reflect.Method; import java.net.MalformedURLException; import java.net.URL; import java.util.Arrays; @@ -132,7 +129,10 @@ public class DownloadRemoteIndexTask && this.networkProxy.isUseNtlm() ) ? "-ntlm" : "" ); final Wagon wagon = wagonFactory.getWagon( wagonProtocol ); - setupWagonReadTimeout( wagon ); + int timeoutInMilliseconds = remoteRepository.getTimeout() * 1000; + // FIXME olamy having 2 config values + wagon.setReadTimeout( timeoutInMilliseconds ); + wagon.setTimeout( timeoutInMilliseconds ); wagon.addTransferListener( new DownloadListener() ); ProxyInfo proxyInfo = null; @@ -220,22 +220,6 @@ public class DownloadRemoteIndexTask } } - private void setupWagonReadTimeout( Wagon wagon ) - { - try - { - HttpConfiguration httpConfiguration = new HttpConfiguration().setAll( - new HttpMethodConfiguration().setReadTimeout( remoteRepository.getRemoteDownloadTimeout() * 1000 ) ); - Method setHttpConfigurationMethod = - wagon.getClass().getMethod( "setHttpConfiguration", HttpConfiguration.class ); - setHttpConfigurationMethod.invoke( wagon, httpConfiguration ); - } - catch ( Exception e ) - { - log.debug( "unable to set download remote time out for index {}", e.getMessage(), e ); - } - } - public static class DownloadListener implements TransferListener 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 e1057bfb8..2bbde57c1 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 @@ -309,8 +309,9 @@ public class RepositoryModelResolver // Convert seconds to milliseconds int timeoutInMilliseconds = remoteRepository.getTimeout() * 1000; - + // FIXME olamy having 2 config values // Set timeout + wagon.setReadTimeout( timeoutInMilliseconds ); wagon.setTimeout( timeoutInMilliseconds ); try diff --git a/pom.xml b/pom.xml index 4cb641398..f5091a41a 100644 --- a/pom.xml +++ b/pom.xml @@ -72,7 +72,7 @@ 1.2 2.1 4.1.2 - 2.0 + 2.2 1.5-SNAPSHOT 1.0 1.0