Skip to content
Permalink
Browse files
javadoc & don't compute hashes twice
  • Loading branch information
chtompki committed May 30, 2018
1 parent 76d8739 commit cd8911a70c6af6284e7e13113369829c218b6972
Showing 2 changed files with 8 additions and 7 deletions.
@@ -271,6 +271,10 @@ private void copyRemovedArtifactsToWorkingDirectory() throws MojoExecutionExcept
private void hashArtifacts() throws MojoExecutionException {
for (Artifact artifact : detachedArtifacts) {
if (!artifact.getFile().getName().contains("asc")) {
StringBuffer artifactKey = new StringBuffer();
artifactKey.append(artifact.getArtifactId()).append('-')
.append(artifact.getVersion()).append('-')
.append(artifact.getType());
try {
// MD5
String digest;
@@ -283,18 +287,14 @@ private void hashArtifacts() throws MojoExecutionException {
printWriter.println(digest);
}
// SHA-1
try (FileInputStream fis = new FileInputStream(artifact.getFile())) {
digest = DigestUtils.sha1Hex(fis);
}
digest = artifactSha1s.getProperty(artifactKey.toString());
getLog().info(artifact.getFile().getName() + " sha1: " + digest);
try (PrintWriter printWriter = new PrintWriter(
getSha1FilePath(workingDirectory, artifact.getFile()))) {
printWriter.println(digest);
}
// SHA-256
try (FileInputStream fis = new FileInputStream(artifact.getFile())) {
digest = DigestUtils.sha256Hex(fis);
}
digest = artifactSha256s.getProperty(artifactKey.toString());
getLog().info(artifact.getFile().getName() + " sha256: " + digest);
try (PrintWriter printWriter = new PrintWriter(
getSha256FilePath(workingDirectory, artifact.getFile()))) {
@@ -61,8 +61,9 @@
aggregator = true)
public class CommonsDistributionStagingMojo extends AbstractMojo {

/** The name of file generated from the README.vm velocity template to be checked into the dist svn repo. */
private static final String README_FILE_NAME = "README.html";

/** The name of file generated from the HEADER.vm velocity template to be checked into the dist svn repo. */
private static final String HEADER_FILE_NAME = "HEADER.html";

/**

0 comments on commit cd8911a

Please sign in to comment.