Project

General

Profile

« Previous | Next » 

Revision 6822

Added by Chris Jones over 12 years ago

Make sure the local id isn't null when we try to get the object from the local instance.

View differences:

src/edu/ucsb/nceas/metacat/dataone/MNodeService.java
494 494
            try {
495 495
                localId = IdentifierManager.getInstance().getLocalId(pid.getValue());
496 496

  
497
                String msg = "Can't read the object bytes properly, replica is invalid.";
498
                ServiceFailure serviceFailure = new ServiceFailure("2151", msg);
499
                
500
                // if we have a local id, get the local object
501
                try {
502
                    object = MetacatHandler.read(localId);
503
                    
504
                } catch (Exception e) {
505
                    // let the CN know that the replication failed
506
                    setReplicationStatus(thisNodeSession, pid, nodeId, ReplicationStatus.FAILED, serviceFailure);  
507
                    throw serviceFailure;
508
                    
509
                }
510

  
497 511
            } catch (McdbDocNotFoundException e) {
498 512
                logMetacat.info("No replica found. Continuing.");
499 513
                
500 514
            }
501

  
502
            String msg = "Can't read the object bytes properly, replica is invalid.";
503
            ServiceFailure serviceFailure = new ServiceFailure("2151", msg);
504 515
            
505
            try {
506
                object = MetacatHandler.read(localId);
507
                
508
            } catch (Exception e) {
509
                // let the CN know that the replication failed
510
                setReplicationStatus(thisNodeSession, pid, nodeId, ReplicationStatus.FAILED, serviceFailure);  
511
                throw serviceFailure;
512
                
513
            }
514

  
515 516
            // no local replica, get a replica
516 517
            if ( object == null ) {
517 518
                // session should be null to use the default certificate

Also available in: Unified diff