Project

General

Profile

« Previous | Next » 

Revision 6875

Added by Chris Jones over 12 years ago

Minor null checks to avoid NPEs when calling replicate()

View differences:

src/edu/ucsb/nceas/metacat/dataone/MNodeService.java
440 440
            NotAuthorized, InvalidRequest, InsufficientResources,
441 441
            UnsupportedType {
442 442

  
443
        logMetacat.info("MNodeService.replicate() called with parameters: \n"
444
                + "\tSession.Subject      = " + session.getSubject().getValue()
445
                + "\n" + "\tSystemMetadata       = " + sysmeta.toString()
446
                + "\n" + "\tSource NodeReference =" + sourceNode.getValue());
447

  
443
        if (session != null && sysmeta != null && sourceNode != null) {
444
            logMetacat.info("MNodeService.replicate() called with parameters: \n" +
445
                            "\tSession.Subject      = "                           +
446
                            session.getSubject().getValue() + "\n"                +
447
                            "\tSystemMetadata       = " + sysmeta.toString()      +
448
                            "\n" + "\tSource NodeReference ="                     +
449
                            sourceNode.getValue());
450
        }
448 451
        boolean result = false;
449 452
        String nodeIdStr = null;
450 453
        NodeReference nodeId = null;
......
464 467
        
465 468
        // TODO: check credentials
466 469
        // cannot be called by public
467
        if (session == null) {
470
        if (session.getSubject() == null) {
468 471
            String msg = "No session was provided.";
469 472
            failure = new NotAuthorized("2152", msg);
470 473
            setReplicationStatus(thisNodeSession, pid, nodeId, ReplicationStatus.FAILED, failure);

Also available in: Unified diff