Looks good to me. I say roll it into trunk.
A couple of uncertainties:
- isn't doFinal required?
- I think it can use more tests
Here's some nitpicking that might reduce the amount of code and make
it clearer:
- rename Hash to ChecksumAlgorithm (might as well be consistent and
use checksum everywhere instead of alternating through Hash, Digest,
Checksum?)
- likewise Hasher -> Checksum
- there some duplicated code in isValidChecksums and fixChecksums that
can be factored out
- what about passing referenceFile as a final field, since every
method uses it?
- but if not, it'd be better if the arg order of getChecksumFile
and createChecksum and calculateChecksum were consistent (I would go
with File first)
- I'd rename ChecksumFile as ChecksummedFile
- parseChecksum can be private?
- the two isValidChecksum(s) methods do different things.
isValidChecksum should be isValidChecksum(Hash hash) { return
isValidChecksums( new Hash[] { hash } ); }. Maybe another static
convenience method is needed for the checksum file
checkChecksumFile( File checksumFile ).
- Brett
On 09/04/2008, at 2:39 PM, Joakim Erdfelt wrote:
I've been taking a stab and removing some of our dependencies on
various plexus components.
First up, plexus-digest.
I've taken the varied code from many locations and come up with a
stand alone archiva-checksum lib/component that I hope to be able to
integrate into archiva/trunk.
So ... uhm ... consider this a call for discussion. ;-)
- Joakim
--
Brett Porter
[EMAIL PROTECTED]
http://blogs.exist.com/bporter/