cstamas commented on code in PR #200:
URL: https://github.com/apache/maven-resolver/pull/200#discussion_r990936945
##########
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
Review Comment:
rather "must not return null, as the enabled check already passed (is
enabled)"
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]