Project

General

Profile

« Previous | Next » 

Revision 6530

throw InvalidToken when the Session parameter is null for create()
https://redmine.dataone.org/issues/1850

View differences:

src/edu/ucsb/nceas/metacat/dataone/MNodeService.java
349 349
    public Identifier create(Session session, Identifier pid, InputStream object, SystemMetadata sysmeta) throws InvalidToken, ServiceFailure, NotAuthorized,
350 350
            IdentifierNotUnique, UnsupportedType, InsufficientResources, InvalidSystemMetadata, NotImplemented, InvalidRequest {
351 351

  
352
    	// check for null session
353
        if (session == null) {
354
        	throw new InvalidToken("1110", "Session is required to WRITE to the Node.");
355
        }
352 356
        // set the submitter to match the certificate
353 357
        sysmeta.setSubmitter(session.getSubject());
354 358
        // set the originating node
src/edu/ucsb/nceas/metacat/dataone/D1NodeService.java
145 145

  
146 146
    Identifier resultPid = null;
147 147
    String localId = null;
148
    Subject subject = session.getSubject();
149 148
    boolean allowed = false;
150 149
    
150
    // check for null session
151
    if (session == null) {
152
    	throw new InvalidToken("4894", "Session is required to WRITE to the Node.");
153
    }
154
    Subject subject = session.getSubject();
155

  
151 156
    // be sure the user is authenticated for create()
152 157
    if (subject == null || subject.getValue() == null || 
153 158
        subject.getValue().toLowerCase().equals(Constants.PUBLIC_SUBJECT) ) {

Also available in: Unified diff