Project

General

Profile

« Previous | Next » 

Revision 6757

If a member node cannot be found in the node list matching the targetNodeSubject given in isNodeAuthorized(), throw a ServiceFailure exception.

View differences:

src/edu/ucsb/nceas/metacat/dataone/CNodeService.java
910 910
          throw new ServiceFailure("4872", msg);
911 911
          
912 912
      }
913
      
914
      // can't find a node listed with the given subject
915
      if ( targetNode == null ) {
916
          String msg = "There is no Member Node registered with a node subject " +
917
              "matching " + targetNodeSubject.getValue();
918
          logMetacat.info(msg);
919
          throw new ServiceFailure("4872", msg);
920
          
921
      }
922
      
913 923
      //lock, get, and unlock the pid
914 924
      lock = HazelcastService.getInstance().getLock(pid.getValue());
915 925
      lock.lock();
......
927 937
              for (Replica replica : replicaList) {
928 938
                  ReplicationStatus status = replica.getReplicationStatus();
929 939
                  NodeReference listedNode = replica.getReplicaMemberNode();
930
                  logMetacat.debug("Comparing " + listedNode.getValue() + " to " + 
931
                      targetNode.getValue());
932
                  if (listedNode.getValue().equals(targetNode.getValue())
933
                          && status.equals(ReplicationStatus.REQUESTED)) {
934
                      isAllowed = true;
935
                      break;
940
                  if ( listedNode != null && targetNode != null ) {
941
                      logMetacat.debug("Comparing " + listedNode.getValue()
942
                              + " to " + targetNode.getValue());
943
                      
944
                      if (listedNode.getValue().equals(targetNode.getValue())
945
                              && status.equals(ReplicationStatus.REQUESTED)) {
946
                          isAllowed = true;
947
                          break;
936 948

  
949
                      }
937 950
                  }
938 951
              }
939 952
          }
......
950 963
    } catch (RuntimeException e) {
951 964
    	  ServiceFailure sf = new ServiceFailure("4872", 
952 965
                "Runtime Exception: Couldn't determine if node is allowed: " + 
953
                e.getMessage());
966
                e.getCause().getMessage());
954 967
    	  sf.initCause(e);
955 968
        throw sf;
956 969
        

Also available in: Unified diff