Skip to content

Commit

Permalink
[MRESOLVER-305] Handle blocked state at connector level (#228)
Browse files Browse the repository at this point in the history
As blocked is really about block remote access. Locally cached
things should not be affected, but current solution did not cover
all execution paths.

---

https://issues.apache.org/jira/browse/MRESOLVER-305
  • Loading branch information
cstamas committed Dec 22, 2022
1 parent e4d4140 commit c5619a6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -575,20 +575,6 @@ private void performDownloads( RepositorySystemSession session, ResolutionGroup

try
{
RemoteRepository repo = group.repository;
if ( repo.isBlocked() )
{
if ( repo.getMirroredRepositories().isEmpty() )
{
throw new NoRepositoryConnectorException( repo, "Blocked repository: " + repo );
}
else
{
throw new NoRepositoryConnectorException( repo, "Blocked mirror for repositories: "
+ repo.getMirroredRepositories() );
}
}

try ( RepositoryConnector connector =
repositoryConnectorProvider.newRepositoryConnector( session, group.repository ) )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,20 @@ public RepositoryConnector newRepositoryConnector( RepositorySystemSession sessi
throws NoRepositoryConnectorException
{
requireNonNull( repository, "remote repository cannot be null" );

if ( repository.isBlocked() )
{
if ( repository.getMirroredRepositories().isEmpty() )
{
throw new NoRepositoryConnectorException( repository, "Blocked repository: " + repository );
}
else
{
throw new NoRepositoryConnectorException( repository, "Blocked mirror for repositories: "
+ repository.getMirroredRepositories() );
}
}

RemoteRepositoryFilter filter = remoteRepositoryFilterManager.getRemoteRepositoryFilter( session );

PrioritizedComponents<RepositoryConnectorFactory> factories = new PrioritizedComponents<>( session );
Expand Down

0 comments on commit c5619a6

Please sign in to comment.