Project

General

Profile

« Previous | Next » 

Revision 6819

Set the replication status to invalidated when we have a localId, but getting the object bytes fails for any reason.

View differences:

src/edu/ucsb/nceas/metacat/dataone/MNodeService.java
493 493
            // do we already have a replica?
494 494
            try {
495 495
                localId = IdentifierManager.getInstance().getLocalId(pid.getValue());
496
                object = MetacatHandler.read(localId);
497 496

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

  
502
            String msg = "Can't read the object bytes properly, replica is invalid.";
503
            ServiceFailure serviceFailure = new ServiceFailure("2151", msg);
504
            
505
            try {
506
                object = MetacatHandler.read(localId);
501 507
            } catch (PropertyNotFoundException e) {
502
                // TODO Auto-generated catch block
503
                e.printStackTrace();
508
                setReplicationStatus(thisNodeSession, pid, nodeId, ReplicationStatus.INVALIDATED, serviceFailure);  
504 509
                
505 510
            } catch (ParseLSIDException e) {
506
                // TODO Auto-generated catch block
507
                e.printStackTrace();
511
                setReplicationStatus(thisNodeSession, pid, nodeId, ReplicationStatus.INVALIDATED, serviceFailure);  
508 512
                
509 513
            } catch (McdbException e) {
510
                // TODO Auto-generated catch block
511
                e.printStackTrace();
514
                setReplicationStatus(thisNodeSession, pid, nodeId, ReplicationStatus.INVALIDATED, serviceFailure);  
512 515
                
513 516
            } catch (SQLException e) {
514
                // TODO Auto-generated catch block
515
                e.printStackTrace();
517
                setReplicationStatus(thisNodeSession, pid, nodeId, ReplicationStatus.INVALIDATED, serviceFailure);  
518
                
516 519
            } catch (ClassNotFoundException e) {
517
                // TODO Auto-generated catch block
518
                e.printStackTrace();
520
                setReplicationStatus(thisNodeSession, pid, nodeId, ReplicationStatus.INVALIDATED, serviceFailure);  
521
                
519 522
            } catch (IOException e) {
520
                // TODO Auto-generated catch block
521
                e.printStackTrace();
523
                setReplicationStatus(thisNodeSession, pid, nodeId, ReplicationStatus.INVALIDATED, serviceFailure);  
524
               
522 525
            }
523 526

  
524 527
            // no local replica, get a replica
525
            if (localSystemMetadata == null) {
528
            if ( object == null ) {
526 529
                // session should be null to use the default certificate
527 530
                // location set in the Certificate manager
528 531
                object = mn.getReplica(thisNodeSession, pid);

Also available in: Unified diff