From: skygo Date: Thu, 30 Aug 2012 22:09:52 +0000 (+0000) Subject: further fix to MRM1658 X-Git-Tag: archiva-1.4-M3~314 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ba0ab8c0212e2113291abe2fd58947eb7a42c5f5;p=archiva.git further fix to MRM1658 git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1379186 13f79535-47bb-0310-9956-ffa450edef68 --- 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 92fe5a097..6895cffbe 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 @@ -54,6 +54,7 @@ import java.io.File; import java.io.IOException; import java.util.List; import java.util.Map; +import org.apache.archiva.metadata.repository.storage.RepositoryStorageRuntimeException; public class RepositoryModelResolver implements ModelResolver @@ -90,6 +91,8 @@ public class RepositoryModelResolver { this( new File( managedRepository.getLocation() ), pathTranslator ); + this.managedRepository = managedRepository; + this.wagonFactory = wagonFactory; this.remoteRepositories = remoteRepositories; @@ -109,7 +112,20 @@ public class RepositoryModelResolver if ( !model.exists() ) { - + if ( VersionUtil.isSnapshot( version ) ) // skygo trying to improve speed by honoring managed configuration MRM-1658 + { + if ( managedRepository.isReleases() && !managedRepository.isSnapshots() ) + { + throw new UnresolvableModelException("lookforsnaponreleaseonly", groupId, artifactId, version ); + } + } + else + { + if ( !managedRepository.isReleases() && managedRepository.isSnapshots() ) + { + throw new UnresolvableModelException("lookforsreleaseonsneponly", groupId, artifactId, version ); + } + } // is a SNAPSHOT ? so we can try to find locally before asking remote repositories. if ( StringUtils.contains( version, VersionUtil.SNAPSHOT ) ) { @@ -231,6 +247,7 @@ public class RepositoryModelResolver String protocol = getProtocol( remoteRepository.getUrl() ); final NetworkProxy networkProxy = this.networkProxyMap.get( remoteRepository.getId() ); + // XXX skygo: look strange to me wagon = ( networkProxy != null && networkProxy.isUseNtlm() ) ? wagonFactory.getWagon( "wagon#" + protocol + "-ntlm" ) : wagonFactory.getWagon( "wagon#" + protocol ); wagon = wagonFactory.getWagon( "wagon#" + protocol );