From c43c6b90a6ae58ee7d8bba16b5ca07ed580bd78d Mon Sep 17 00:00:00 2001 From: James William Dumay Date: Thu, 14 Aug 2008 02:17:16 +0000 Subject: [PATCH] MRM-907 - Remove VersionedReference/ProjectReference/ArtifactReference from RepositoryProxyConnectors * A few more null checks for good measure. * Metadata should always be updated even if the file does not exist. (wsmoak will love this, no more having to touch files). git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@685748 13f79535-47bb-0310-9956-ffa450edef68 --- .../DefaultRepositoryProxyConnectors.java | 2 +- .../repository/metadata/MetadataTools.java | 25 +++++++++++++++---- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java b/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java index 000c8c6c8..2c5da3ebf 100644 --- a/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java +++ b/archiva-modules/archiva-base/archiva-proxy/src/main/java/org/apache/maven/archiva/proxy/DefaultRepositoryProxyConnectors.java @@ -320,7 +320,7 @@ public class DefaultRepositoryProxyConnectors metadataNeedsUpdating = true; } - if ( metadataNeedsUpdating ) + if ( metadataNeedsUpdating || !localFile.exists()) { try { diff --git a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/MetadataTools.java b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/MetadataTools.java index ce29b991d..06e387416 100644 --- a/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/MetadataTools.java +++ b/archiva-modules/archiva-base/archiva-repository-layer/src/main/java/org/apache/maven/archiva/repository/metadata/MetadataTools.java @@ -439,7 +439,18 @@ public class MetadataTools metadata = RepositoryMetadataMerge.merge(metadata, proxiedMetadata); } - Set availableVersions = new HashSet(metadata.getAvailableVersions()); + if (metadata == null) + { + log.debug("No metadata to update for " + logicalResource); + return; + } + + Set availableVersions = new HashSet(); + List metadataAvailableVersions = metadata.getAvailableVersions(); + if (metadataAvailableVersions != null) + { + availableVersions.addAll(metadataAvailableVersions); + } availableVersions = findPossibleVersions(availableVersions, metadataFile.getParentFile()); if (availableVersions.size() > 0) @@ -500,12 +511,16 @@ public class MetadataTools } } - for (String proxyId : proxies.get(managedRepository.getId())) + Set proxyIds = proxies.get(managedRepository.getId()); + if (proxyIds != null) { - ArchivaRepositoryMetadata proxyMetadata = readProxyMetadata( managedRepository, logicalResource, proxyId ); - if (proxyMetadata != null) + for (String proxyId : proxyIds) { - metadatas.add(proxyMetadata); + ArchivaRepositoryMetadata proxyMetadata = readProxyMetadata( managedRepository, logicalResource, proxyId ); + if (proxyMetadata != null) + { + metadatas.add(proxyMetadata); + } } } -- 2.39.5