This error was reported by Nishen Naidoo (nishen@melcoe.mq.edu.au). His original email and test code are included as attachments.
When calling addDatastream() or modifyDatastreamByReference() for a managed datastream, if valid checksumType and checksum parameters are included with the call the following error results:
"fedora.server.errors.ValidationException: Checksum Mismatch: ExceptionReadingStream"
The reason for the exception is that the Datastream.computeChecksum() call attempts to get the content stream by reading it from LLStore (see DatastreamManagedContent.getContentStream()), but the datastream is not actually written to LLStore until the final commit.
The question this raises is: Which comes first, the commit or the checksum check? If the checksum check needs to happen first the content stream needs to be read earlier so that the checksum computation can happen. If the commit comes first, then the commit may need to be backed out if the checksum check fails.
Original error report from Nishen Naidoo
Logged In: YES
user_id=1987639
Originator: YES
File Added: test-code.txt
Test code submitted by Nishen Naidoo