Revision 5431
Added by berkley over 14 years ago
src/edu/ucsb/nceas/metacat/dataone/CrudService.java | ||
---|---|---|
243 | 243 |
//insert the systemmetadata object |
244 | 244 |
SessionData sessionData = getSessionData(token); |
245 | 245 |
insertSystemMetadata(sm, sessionData); |
246 |
|
|
247 |
String username = sessionData.getUserName(); |
|
246 |
String username = "public"; |
|
247 |
if(sessionData != null) |
|
248 |
{ |
|
249 |
username = sessionData.getUserName(); |
|
250 |
} |
|
248 | 251 |
EventLog.getInstance().log(metacatUrl, |
249 | 252 |
username, localId, "generateMissingSystemMetadata"); |
250 | 253 |
} |
... | ... | |
270 | 273 |
|
271 | 274 |
// authenticate & get user info |
272 | 275 |
SessionData sessionData = getSessionData(token); |
273 |
String username = sessionData.getUserName(); |
|
274 |
String[] groups = sessionData.getGroupNames(); |
|
276 |
String username = "public"; |
|
277 |
String[] groups = null; |
|
278 |
if(sessionData != null) |
|
279 |
{ |
|
280 |
username = sessionData.getUserName(); |
|
281 |
groups = sessionData.getGroupNames(); |
|
282 |
} |
|
275 | 283 |
String localId = null; |
276 | 284 |
|
277 | 285 |
if (username == null || username.equals("public")) |
... | ... | |
370 | 378 |
} |
371 | 379 |
|
372 | 380 |
IdentifierManager im = IdentifierManager.getInstance(); |
373 |
String username = sessionData.getUserName(); |
|
381 |
String username = "public"; |
|
382 |
if(sessionData != null) |
|
383 |
{ |
|
384 |
username = sessionData.getUserName(); |
|
385 |
} |
|
374 | 386 |
EventLog.getInstance().log(metacatUrl, |
375 | 387 |
username, im.getLocalId(guid.getValue()), "update"); |
376 | 388 |
logCrud.info("update localId:" + im.getLocalId(guid.getValue()) + " guid:" + guid.getValue()); |
... | ... | |
423 | 435 |
handler.setAccess(metacatUrl, sessionData.getUserName(), smlocalid, |
424 | 436 |
principal, permNum, permissionType, permissionOrder); |
425 | 437 |
} |
426 |
String username = sessionData.getUserName(); |
|
438 |
String username = "public"; |
|
439 |
if(sessionData != null) |
|
440 |
{ |
|
441 |
username = sessionData.getUserName(); |
|
442 |
} |
|
427 | 443 |
EventLog.getInstance().log(metacatUrl, |
428 | 444 |
username, im.getLocalId(id.getValue()), "setAccess"); |
429 | 445 |
logCrud.info("setAccess"); |
... | ... | |
788 | 804 |
return "Completed"; |
789 | 805 |
} |
790 | 806 |
}; |
791 |
String username = sessionData.getUserName(); |
|
807 |
String username = "public"; |
|
808 |
if(sessionData != null) |
|
809 |
{ |
|
810 |
username = sessionData.getUserName(); |
|
811 |
} |
|
812 |
|
|
792 | 813 |
EventLog.getInstance().log(metacatUrl, |
793 | 814 |
username, im.getLocalId(guid.getValue()), "read"); |
794 | 815 |
logCrud.info("get localId:" + localId + " guid:" + guid.getValue()); |
... | ... | |
1019 | 1040 |
|
1020 | 1041 |
// Deserialize the xml to create a SystemMetadata object |
1021 | 1042 |
SystemMetadata sysmeta = deserializeSystemMetadata(objectStream); |
1022 |
String username = sessionData.getUserName(); |
|
1043 |
String username = "public"; |
|
1044 |
if(sessionData != null) |
|
1045 |
{ |
|
1046 |
username = sessionData.getUserName(); |
|
1047 |
} |
|
1023 | 1048 |
EventLog.getInstance().log(metacatUrl, |
1024 | 1049 |
username, im.getLocalId(guid.getValue()), "read"); |
1025 | 1050 |
logCrud.info("getSystemMetadata localId: " + localId + " guid:" + guid.getValue()); |
... | ... | |
1151 | 1176 |
private void insertDataObject(InputStream object, Identifier guid, |
1152 | 1177 |
SessionData sessionData) throws ServiceFailure { |
1153 | 1178 |
|
1154 |
String username = sessionData.getUserName(); |
|
1155 |
String[] groups = sessionData.getGroupNames(); |
|
1179 |
String username = "public"; |
|
1180 |
String[] groups = null; |
|
1181 |
if(sessionData != null) |
|
1182 |
{ |
|
1183 |
username = sessionData.getUserName(); |
|
1184 |
groups = sessionData.getGroupNames(); |
|
1185 |
} |
|
1156 | 1186 |
|
1157 | 1187 |
// generate guid/localId pair for object |
1158 | 1188 |
logMetacat.debug("Generating a guid/localId mapping"); |
Also available in: Unified diff
fixed more NPE problems with sessionData. hopefully got them all this time