Skip to content

Commit

Permalink
SAK-40926 avoid NPE in Lessons during a site import (sakaiproject#6248)
Browse files Browse the repository at this point in the history
  • Loading branch information
ottenhoff authored and ern committed Nov 13, 2018
1 parent 4afcba2 commit 15a520d
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,20 @@ public Collection<Long> getOrphanPageIds() {

private void loadOrphanedPages() {
log.debug("loadOrphanedPages for site:" +siteId);
Map<Long,SimplePage> allPagesInSite = new HashMap<Long,SimplePage>();
List<SimplePage> sitePages = simplePageToolDao.getSitePages(siteId);

if (sitePages == null || sitePages.isEmpty()) {
return;
}

// Load our map of all pages
//
// This seems a bit wasteful: pagePickerProducer doesn't
// really need the pages at all (it just uses the keys
// of this map as a set). Could probably refactor this
// not to pull all the pages into memory if needed.
for (SimplePage p: simplePageToolDao.getSitePages(siteId)) {
Map<Long,SimplePage> allPagesInSite = new HashMap<Long,SimplePage>();
for (SimplePage p: sitePages) {
allPagesInSite.put(p.getPageId(), p);
}

Expand Down Expand Up @@ -111,7 +116,5 @@ private void loadOrphanedPages() {
log.debug(String.valueOf(pageId));
}
}


}
}

0 comments on commit 15a520d

Please sign in to comment.