Revision 8414
Added by Jing Tao about 11 years ago
src/edu/ucsb/nceas/metacat/dataone/MNodeService.java | ||
---|---|---|
513 | 513 |
if (session == null || session.getSubject() == null) { |
514 | 514 |
String msg = "No session was provided to replicate identifier " + |
515 | 515 |
sysmeta.getIdentifier().getValue(); |
516 |
logMetacat.info(msg);
|
|
516 |
logMetacat.error(msg);
|
|
517 | 517 |
throw new NotAuthorized("2152", msg); |
518 | 518 |
|
519 | 519 |
} |
... | ... | |
528 | 528 |
} catch (PropertyNotFoundException e1) { |
529 | 529 |
String msg = "Couldn't get dataone.nodeId property: " + e1.getMessage(); |
530 | 530 |
failure = new ServiceFailure("2151", msg); |
531 |
setReplicationStatus(thisNodeSession, pid, nodeId, ReplicationStatus.FAILED, failure); |
|
531 |
//setReplicationStatus(thisNodeSession, pid, nodeId, ReplicationStatus.FAILED, failure);
|
|
532 | 532 |
logMetacat.error(msg); |
533 |
return true; |
|
533 |
//return true; |
|
534 |
throw new ServiceFailure("2151", msg); |
|
534 | 535 |
|
535 | 536 |
} |
536 | 537 |
|
... | ... | |
586 | 587 |
logMetacat.error(msg); |
587 | 588 |
throw new ServiceFailure("2151", msg); |
588 | 589 |
|
590 |
} catch (NotAuthorized e) { |
|
591 |
String msg = "Could not retrieve object to replicate (NotAuthorized): "+ e.getMessage(); |
|
592 |
failure = new ServiceFailure("2151", msg); |
|
593 |
setReplicationStatus(thisNodeSession, pid, nodeId, ReplicationStatus.FAILED, failure); |
|
594 |
logMetacat.error(msg); |
|
595 |
throw new ServiceFailure("2151", msg); |
|
596 |
} catch (NotImplemented e) { |
|
597 |
String msg = "Could not retrieve object to replicate (mn.getReplica NotImplemented): "+ e.getMessage(); |
|
598 |
failure = new ServiceFailure("2151", msg); |
|
599 |
setReplicationStatus(thisNodeSession, pid, nodeId, ReplicationStatus.FAILED, failure); |
|
600 |
logMetacat.error(msg); |
|
601 |
throw new ServiceFailure("2151", msg); |
|
602 |
} catch (ServiceFailure e) { |
|
603 |
String msg = "Could not retrieve object to replicate (ServiceFailure): "+ e.getMessage(); |
|
604 |
failure = new ServiceFailure("2151", msg); |
|
605 |
setReplicationStatus(thisNodeSession, pid, nodeId, ReplicationStatus.FAILED, failure); |
|
606 |
logMetacat.error(msg); |
|
607 |
throw new ServiceFailure("2151", msg); |
|
608 |
} catch (InsufficientResources e) { |
|
609 |
String msg = "Could not retrieve object to replicate (InsufficientResources): "+ e.getMessage(); |
|
610 |
failure = new ServiceFailure("2151", msg); |
|
611 |
setReplicationStatus(thisNodeSession, pid, nodeId, ReplicationStatus.FAILED, failure); |
|
612 |
logMetacat.error(msg); |
|
613 |
throw new ServiceFailure("2151", msg); |
|
589 | 614 |
} |
590 | 615 |
|
591 | 616 |
// verify checksum on the object, if supported |
... | ... | |
601 | 626 |
logMetacat.error(msg); |
602 | 627 |
ServiceFailure sf = new ServiceFailure("2151", msg); |
603 | 628 |
sf.initCause(e); |
629 |
setReplicationStatus(thisNodeSession, pid, nodeId, ReplicationStatus.FAILED, sf); |
|
604 | 630 |
throw sf; |
605 | 631 |
} |
606 | 632 |
if (!givenChecksum.getValue().equals(computedChecksum.getValue())) { |
... | ... | |
608 | 634 |
"is " + givenChecksum.getValue()); |
609 | 635 |
logMetacat.error("Computed checksum for " + pid.getValue() + |
610 | 636 |
"is " + computedChecksum.getValue()); |
611 |
throw new ServiceFailure("2151", |
|
612 |
"Computed checksum does not match declared checksum"); |
|
637 |
String msg = "Computed checksum does not match declared checksum"; |
|
638 |
failure = new ServiceFailure("2151", msg); |
|
639 |
setReplicationStatus(thisNodeSession, pid, nodeId, ReplicationStatus.FAILED, failure); |
|
640 |
throw new ServiceFailure("2151", msg); |
|
613 | 641 |
} |
614 | 642 |
} |
615 | 643 |
|
Also available in: Unified diff
Add the code to set the replication status when some exceptions happen.