Uploaded image for project: 'Sakai'
  1. Sakai
  2. SAK-39926

NPE in Sitestats if lessons is not added to site

    Details

    • Type: Bug
    • Status: Verified
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 12.1, 19.0
    • Fix Version/s: 12.2, 19.0
    • Component/s: Sitestats
    • Labels:
      None
    • 12 status:
      Resolved
    • 11 status:
      Won't Fix
    • Test Plan:
      Hide

      Create a site, add only the sitestats tool
      Click the sitestats tool
      Check the server logs

      There shouldn't be a stack trace. If the Lessons tool is present there isn't one, but if it isn't added there is a stack trace.

      Show
      Create a site, add only the sitestats tool Click the sitestats tool Check the server logs There shouldn't be a stack trace. If the Lessons tool is present there isn't one, but if it isn't added there is a stack trace.

      Description

      It looks like this is a regression from SAK-32104

      If you create a site without the Lessons tool, sitestats throwns this NPE. 

       

      26-Apr-2018 10:39:03.768 ERROR [http-nio-8080-exec-7] org.sakaiproject.sitestats.tool.wicket.widget.LessonsWidget.getTotalPages Caught exception while getting the page total. Setting totalPages to 0 ...
      java.lang.NullPointerException
       at org.sakaiproject.sitestats.impl.StatsManagerImpl.getTotalLessonPages(StatsManagerImpl.java:879)
      

      I believe this is because getSitePages returns a null when the site doesn't have lessons.

      			return lessonBuilderService.getSitePages(siteId).size();
      

      Even though this doesn't seem to cause a user facing error, this should be caught to avoid the stack trace in the logs.

        Gliffy Diagrams

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  farreri Miguel Pellicer
                  Reporter:
                  jonespm Matthew Jones
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  4 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:

                    Git Source Code