Revision 6693
Added by ben leinfelder almost 13 years ago
src/edu/ucsb/nceas/metacat/dataone/MNodeService.java | ||
---|---|---|
474 | 474 |
throw new ServiceFailure("2151", "Could not retrieve object to replicate (NotFound): " + e.getMessage()); |
475 | 475 |
} |
476 | 476 |
|
477 |
// verify checksum on the object, if supported |
|
478 |
if (object.markSupported()) { |
|
479 |
Checksum givenChecksum = sysmeta.getChecksum(); |
|
480 |
Checksum computedChecksum = null; |
|
481 |
try { |
|
482 |
computedChecksum = ChecksumUtil.checksum(object, givenChecksum.getAlgorithm()); |
|
483 |
object.reset(); |
|
484 |
} catch (Exception e) { |
|
485 |
String msg = "Error computing checksum on replica: " + e.getMessage(); |
|
486 |
ServiceFailure sf = new ServiceFailure("2151", msg); |
|
487 |
sf.initCause(e); |
|
488 |
throw sf; |
|
489 |
} |
|
490 |
if (!givenChecksum.getValue().equals(computedChecksum)) { |
|
491 |
throw new ServiceFailure("2151", "Computed checksum does not match declared checksum"); |
|
492 |
} |
|
493 |
} |
|
494 |
|
|
477 | 495 |
// add it to local store |
478 | 496 |
Identifier retPid; |
479 | 497 |
try { |
Also available in: Unified diff
verify checksum when retrieving replica from another member node.
https://redmine.dataone.org/issues/1794