Skip to content

Commit

Permalink
DASH-324 deal with NullPointerException when related assignment, anno…
Browse files Browse the repository at this point in the history
…uncement channel or user was removed

git-svn-id: https://source.sakaiproject.org/svn/dashboard/trunk@315050 66ffb92e-73f9-0310-93c1-f5514f145a0a
  • Loading branch information
zqian committed Oct 31, 2014
1 parent f5d7b87 commit 70d4d44
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,10 @@ public boolean isAvailable(String entityReference) {
{
String channelId = getChannelIdFromReference(entityReference);
AnnouncementChannel channel = (AnnouncementChannel) announcementService.getChannel(channelId);

// return false if channel does not exist
if (channel == null) return false;

String siteId = channel.getContext();
if (!dashboardLogic.MOTD_CONTEXT.equals(siteId) && !sakaiProxy.isSitePublished(siteId))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,10 @@ public void init() {

public boolean isAvailable(String entityReference) {
Assignment assn = (Assignment) sakaiProxy.getEntity(entityReference);

// return false if the assignment is no longer available
if (assn == null) return false;

String siteId = assn.getContext();
if (!sakaiProxy.isSitePublished(siteId))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1145,9 +1145,12 @@ protected Person getOrCreatePerson(String sakaiId) {
Person person = dao.getPersonBySakaiId(sakaiId);
if(person == null) {
User userObj = this.sakaiProxy.getUser(sakaiId);
person = new Person(sakaiId, userObj.getEid());
dao.addPerson(person);
person = dao.getPersonBySakaiId(sakaiId);
if (userObj != null)
{
person = new Person(sakaiId, userObj.getEid());
dao.addPerson(person);
person = dao.getPersonBySakaiId(sakaiId);
}
}
return person;
}
Expand Down

0 comments on commit 70d4d44

Please sign in to comment.