SakaiPersonManager.save can throw a NPE if no session has been established
GENERAL
TESTING
GENERAL
TESTING
Description
SakaiPersonManager.save can throw a NPE if no session has been established. This is because it uses a String.equals(String) to compare, which is not null safe and an NPE could be thrown when evaluating which causes a stack trace:
// if it is a user mutable record, ensure the user is updating their own record if (!SessionManager.getCurrentSessionUserId().equals(sakaiPerson.getAgentUuid()) && !SecurityService.isSuperUser()) { // AuthZ - Ensure the current user is updating their own record if (!SessionManager.getCurrentSessionUserId().equals(sakaiPerson.getAgentUuid())) throw new IllegalAccessError("You do not have permissions to update this record!"); }
2011-10-27 09:33:37,717 ERROR main org.sakaiproject.profile2.logic.SakaiProxyImpl - SakaiProxy.updateSakaiPerson(): Couldn't update SakaiPerson: class java.lang.NullPointerException : null java.lang.NullPointerException at org.sakaiproject.component.common.edu.person.SakaiPersonManagerImpl.save(SakaiPersonManagerImpl.java:302)
SakaiPersonManager.save can throw a NPE if no session has been established. This is because it uses a String.equals(String) to compare, which is not null safe and an NPE could be thrown when evaluating which causes a stack trace:
// if it is a user mutable record, ensure the user is updating their own record
if (!SessionManager.getCurrentSessionUserId().equals(sakaiPerson.getAgentUuid()) && !SecurityService.isSuperUser())
{
// AuthZ - Ensure the current user is updating their own record
if (!SessionManager.getCurrentSessionUserId().equals(sakaiPerson.getAgentUuid()))
throw new IllegalAccessError("You do not have permissions to update this record!");
}
2011-10-27 09:33:37,717 ERROR main org.sakaiproject.profile2.logic.SakaiProxyImpl - SakaiProxy.updateSakaiPerson(): Couldn't update SakaiPerson: class java.lang.NullPointerException : null
java.lang.NullPointerException
at org.sakaiproject.component.common.edu.person.SakaiPersonManagerImpl.save(SakaiPersonManagerImpl.java:302)