Currently, verifyObject returns a boolean - true when the ObjectMetadata given matches the argument values, and false if not. However, if an algorithm is not found in the ObjectMetadata hexDigests list, it could potentially return false incorrectly.
To Do (after Metacat integration discussion with @taojing2002):
- Change return type to
void and throw custom exceptions when a value does not match
voNonMatchingSize ~ when the given size does not match
voNonMatchingChecksum ~ when the given checksum does not match what is calculated
voUnsupportedAlgorithm ~ when the given algorithm is not supported (part of MessageDigest's supported algorithms)
- If the algorithm supplied is supported, but not found in the
hexDigests list, calculate it and compare to the checksum value given (and throw an exception if it doesn't match)
- Reminder: Ensure that a
hexDigests.get(checksumAlgorithm) null value is accounted for/handled
Currently,
verifyObjectreturns a boolean - true when theObjectMetadatagiven matches the argument values, and false if not. However, if an algorithm is not found in theObjectMetadatahexDigestslist, it could potentially returnfalseincorrectly.To Do (after Metacat integration discussion with @taojing2002):
voidand throw custom exceptions when a value does not matchvoNonMatchingSize~ when the given size does not matchvoNonMatchingChecksum~ when the given checksum does not match what is calculatedvoUnsupportedAlgorithm~ when the given algorithm is not supported (part ofMessageDigest's supported algorithms)hexDigestslist, calculate it and compare to the checksum value given (and throw an exception if it doesn't match)hexDigests.get(checksumAlgorithm)null value is accounted for/handled