Project

General

Profile

« Previous | Next » 

Revision 6310

Added by Chris Jones over 13 years ago

Fix a NullPointerException issue when the SubjectList in a Session is null.

View differences:

src/edu/ucsb/nceas/metacat/dataone/MNodeService.java
27 27
import java.io.InputStream;
28 28
import java.security.NoSuchAlgorithmException;
29 29
import java.sql.SQLException;
30
import java.util.ArrayList;
30 31
import java.util.Date;
31 32
import java.util.List;
32 33

  
......
162 163
    String localId = null;
163 164
    boolean allowed = false;
164 165
    Subject subject = session.getSubject();
165
    List<Group> groupList = session.getSubjectList().getGroupList();
166
    String[] groups = new String[groupList.size()];
166
    List<Group> groupList = new ArrayList<Group>();
167
    String[] groups = new String[0];
168
    if ( session.getSubjectList() != null ) {
169
      groupList = session.getSubjectList().getGroupList();
170
      groups = new String[groupList.size()];
171
    	
172
    }
167 173
    IdentifierManager im = IdentifierManager.getInstance();
168 174
    
169 175
    // put the group names into a string array
......
268 274
    String localId = null;
269 275
    boolean allowed = false;
270 276
    boolean isScienceMetadata = false;
277
    List<Group> groupList = new ArrayList<Group>();
278
    String[] groups = new String[0];
271 279
    Subject subject = session.getSubject();
272
    List<Group> groupList = session.getSubjectList().getGroupList();
273
    String[] groups = new String[groupList.size()];
280
    if ( session.getSubjectList() != null ) {
281
      groupList = session.getSubjectList().getGroupList();
282
      groups = new String[groupList.size()];
283
    	
284
    }
274 285
    IdentifierManager im = IdentifierManager.getInstance();
275 286

  
276 287
    // put the group names into a string array

Also available in: Unified diff