cstamas commented on code in PR #200: URL: https://github.com/apache/maven-resolver/pull/200#discussion_r990984438
########## maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/checksum/FileTrustedChecksumsSourceSupport.java: ########## @@ -93,24 +94,48 @@ public Map<String, String> getTrustedArtifactChecksums( RepositorySystemSession boolean enabled = ConfigUtils.getBoolean( session, false, CONFIG_PROP_PREFIX + this.name ); if ( enabled ) { - Path basedir = getBasedir( session ); + Path basedir = getBasedir( session, false ); if ( basedir != null && !checksumAlgorithmFactories.isEmpty() ) { - Map<String, String> result = performLookup( - session, basedir, artifact, artifactRepository, checksumAlgorithmFactories ); - - return result == null || result.isEmpty() ? null : result; + return requireNonNull( + performLookup( session, basedir, artifact, artifactRepository, checksumAlgorithmFactories ) + ); + } + else + { + return Collections.emptyMap(); } } return null; } + @Override + public Writer getTrustedArtifactChecksumsWriter( RepositorySystemSession session ) + { + requireNonNull( session, "session is null" ); + boolean enabled = ConfigUtils.getBoolean( session, false, CONFIG_PROP_PREFIX + this.name ); + if ( enabled ) + { + return getWriter( session, getBasedir( session, true ) ); + } + return null; + } + + /** + * Implementors MUST NOT return {@code null} at this point, the source is enabled, worst can happen is checksums + * for asked artifact are not available. + */ protected abstract Map<String, String> performLookup( RepositorySystemSession session, Path basedir, Artifact artifact, ArtifactRepository artifactRepository, List<ChecksumAlgorithmFactory> checksumAlgorithmFactories ); + /** + * If a subclass of this support class decides it should not be writable, this method should return {@code null}. + */ + protected abstract Writer getWriter( RepositorySystemSession session, Path basedir ); Review Comment: As class name says `TrustedChecksumsSource.Writer`, IMHO is clear what it writes. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org