You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by cs...@apache.org on 2023/01/04 22:06:56 UTC
[maven-resolver] branch master updated: [MRESOLVER-309] Do not kill the build when unkown remote layout (#233)
This is an automated email from the ASF dual-hosted git repository.
cstamas pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-resolver.git
The following commit(s) were added to refs/heads/master by this push:
new afca3d85 [MRESOLVER-309] Do not kill the build when unkown remote layout (#233)
afca3d85 is described below
commit afca3d85876ac24227dbe8ddce51a19fc63649ae
Author: Tamas Cservenak <ta...@cservenak.net>
AuthorDate: Wed Jan 4 23:06:50 2023 +0100
[MRESOLVER-309] Do not kill the build when unkown remote layout (#233)
In case remote repository defines unsupported layout, filter should
just let it pass (as resolver will gracefully fail with it anyway),
while throwing RuntimeException caused abruptly stopped build.
---
https://issues.apache.org/jira/browse/MRESOLVER-309
---
.../filter/PrefixesRemoteRepositoryFilterSource.java | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/filter/PrefixesRemoteRepositoryFilterSource.java b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/filter/PrefixesRemoteRepositoryFilterSource.java
index dbd94835..65ab3842 100644
--- a/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/filter/PrefixesRemoteRepositoryFilterSource.java
+++ b/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/filter/PrefixesRemoteRepositoryFilterSource.java
@@ -112,7 +112,9 @@ public final class PrefixesRemoteRepositoryFilterSource
}
/**
- * Caches layout instances for remote repository.
+ * Caches layout instances for remote repository. In case of unknown layout it returns {@code null}.
+ *
+ * @return the layout instance of {@code null} if layout not supported.
*/
private RepositoryLayout cacheLayout( RepositorySystemSession session, RemoteRepository remoteRepository )
{
@@ -124,7 +126,7 @@ public final class PrefixesRemoteRepositoryFilterSource
}
catch ( NoRepositoryLayoutException e )
{
- throw new RuntimeException( e );
+ return null;
}
} );
}
@@ -196,15 +198,25 @@ public final class PrefixesRemoteRepositoryFilterSource
@Override
public Result acceptArtifact( RemoteRepository remoteRepository, Artifact artifact )
{
+ RepositoryLayout repositoryLayout = cacheLayout( session, remoteRepository );
+ if ( repositoryLayout == null )
+ {
+ return new SimpleResult( true, "Unsupported layout: " + remoteRepository );
+ }
return acceptPrefix( remoteRepository,
- cacheLayout( session, remoteRepository ).getLocation( artifact, false ).getPath() );
+ repositoryLayout.getLocation( artifact, false ).getPath() );
}
@Override
public Result acceptMetadata( RemoteRepository remoteRepository, Metadata metadata )
{
+ RepositoryLayout repositoryLayout = cacheLayout( session, remoteRepository );
+ if ( repositoryLayout == null )
+ {
+ return new SimpleResult( true, "Unsupported layout: " + remoteRepository );
+ }
return acceptPrefix( remoteRepository,
- cacheLayout( session, remoteRepository ).getLocation( metadata, false ).getPath() );
+ repositoryLayout.getLocation( metadata, false ).getPath() );
}
private Result acceptPrefix( RemoteRepository remoteRepository, String path )