Skip to content

Commit

Permalink
Merge pull request #221 from TomasHofman/issue-220
Browse files Browse the repository at this point in the history
Metadata resolution failure in one channel should not fail installation
  • Loading branch information
jmesnil authored Mar 22, 2024
2 parents 4bad18d + 5385a4c commit 2bb59b8
Showing 1 changed file with 21 additions and 6 deletions.
27 changes: 21 additions & 6 deletions core/src/main/java/org/wildfly/channel/ChannelImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import java.util.Set;
import java.util.stream.Collectors;

import org.jboss.logging.Logger;
import org.wildfly.channel.spi.MavenVersionsResolver;
import org.wildfly.channel.version.VersionMatcher;

Expand All @@ -38,6 +39,8 @@
*/
class ChannelImpl implements AutoCloseable {

private static final Logger LOG = Logger.getLogger(ChannelImpl.class);

private Channel channelDefinition;

private List<ChannelImpl> requiredChannels = Collections.emptyList();
Expand Down Expand Up @@ -237,17 +240,29 @@ Optional<ResolveLatestVersionResult> resolveLatestVersion(String groupId, String
return Optional.empty();
}
case MAVEN_LATEST:
String latestMetadataVersion = resolver.getMetadataLatestVersion(groupId, artifactId);
if (blocklistedVersions.contains(latestMetadataVersion)) {
try {
String latestMetadataVersion = resolver.getMetadataLatestVersion(groupId, artifactId);
if (blocklistedVersions.contains(latestMetadataVersion)) {
return Optional.empty();
}
return Optional.of(new ResolveLatestVersionResult(latestMetadataVersion, this));
} catch (NoStreamFoundException e) {
LOG.debugf(e, "Metadata resolution for %s:%s failed in channel %s",
groupId, artifactId, this.getChannelDefinition().getName());
return Optional.empty();
}
return Optional.of(new ResolveLatestVersionResult(latestMetadataVersion, this));
case MAVEN_RELEASE:
String releaseMetadataVersion = resolver.getMetadataReleaseVersion(groupId, artifactId);
if (blocklistedVersions.contains(releaseMetadataVersion)) {
try {
String releaseMetadataVersion = resolver.getMetadataReleaseVersion(groupId, artifactId);
if (blocklistedVersions.contains(releaseMetadataVersion)) {
return Optional.empty();
}
return Optional.of(new ResolveLatestVersionResult(releaseMetadataVersion, this));
} catch (NoStreamFoundException e) {
LOG.debugf(e, "Metadata resolution for %s:%s failed in channel %s",
groupId, artifactId, this.getChannelDefinition().getName());
return Optional.empty();
}
return Optional.of(new ResolveLatestVersionResult(releaseMetadataVersion, this));
default:
return Optional.empty();
}
Expand Down

0 comments on commit 2bb59b8

Please sign in to comment.