Skip to content

Commit

Permalink
bug: fix bad merge
Browse files Browse the repository at this point in the history
  • Loading branch information
John Engelman committed Feb 25, 2023
1 parent 38bc31f commit 684bde3
Showing 1 changed file with 5 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,26 +65,16 @@ abstract class AbstractModule {

private TestFile hashFile(TestFile file, String algorithm, int len) {
def hashFile = getHashFile(file, algorithm)
hashFile.text = getHash(file, algorithm)
def hash = getHash(file, algorithm)
hashFile.text = String.format("%0${len}x", hash)
return hashFile
}

private TestFile getHashFile(TestFile file, String algorithm) {
file.parentFile.file("${file.name}.${algorithm}")
}

protected String getHash(TestFile file, String algorithm) {
file.newInputStream().withCloseable {
switch (algorithm) {
case 'sha1':
DigestUtils.sha1Hex(it)
break
case 'md5' :
DigestUtils.md5Hex(it)
break
default:
throw new IOException("Unsupported algorithm " + algorithm)
}
}
protected BigInteger getHash(TestFile file, String algorithm) {
HashUtil.createHash(file, algorithm.toUpperCase()).asBigInteger()
}
}
}

0 comments on commit 684bde3

Please sign in to comment.