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

Logic mismatch in GBNG for AGS created columns between GbGradebookData and GradebookNgBusinessService causes NPE

    XMLWordPrintable

    Details

    • 20 status:
      Verified
    • Test Plan:
      1. Place the LMSTest tool in Lessons. 
      2. Launch the LMSTest tool. 
      3. Create a line item. 
      4. Then navigate to the gradebookng. 
      5. Viola!  Instant NPE.

      Description

      There is a mismatch in the logic between GradebookNgBusinessService.java buildHasAssociatedRubricMap() and GbGradebookData.java loadColumns() when dealing with Line Items created by LTI Advantage

      In GradebookNgBusinessService.java buildHasAssociatedRubricMap() the code looks to getExternalAppName() being not null instead of assignment.isExternallyMaintained() to decide is an assignment is externally maintained or not. It uses the existence of an external app name to indicate that the key in the hasAssociatedRubricMap is supposed to be the externalId.

      {{ String externalAppName = assignment.getExternalAppName();}}
      {{ if(externalAppName != null) {}}

      But in GbGradebookData.loadColumns() it (correctly) uses the isExternallyMaintained() flag to determine when to use the externalId as the key to hasAssociatedRubricMap - which results in the wrong key being used and the hasAssociatedRubricMap.get() returning a null because it cannot find the getExternalId() in the key and then we see an a NPE as the null is cast to a boolean in the line:

      a1.isExternallyMaintained() ? this.hasAssociatedRubricMap.get(a1.getExternalId()) : this.hasAssociatedRubricMap.get(String.valueOf(a1.getId())),

      LTI Advantage (LTI 1.3) columns are created with an external App name non-null but with the isExternallyMaintained() false. This is because as part of the Assignments and Grades Service (AGS) in LTI Advantage, there is a need to allow the external tool to search through gradebook columns that were created by the tool. So AGS indicates that these are normally "internally maintained records" from the perspective of the GradeBook - but stashes its indexing / look up data in the external app name and external id.

      To make this NPE happen, you create a line item using the AGS and then navigate to the gradebook and NPE.

      I have fixed this two ways - the simple fix is to switch GradebookNgBusinessService.buildHasAssociatedRubricMap() to look at assignment.isExternallyMaintained() - this makes key use consistent between the the construction and use of the hasAssociatedRubricMap - you could also put some guardian code in GbGradebookData.loadColumns().

      I think this will need to go back to 20 with haste.  Please review.

        Gliffy Diagrams

          Zeplin

            Attachments

              Issue Links

                Activity

                  People

                  Assignee:
                  csev Charles Severance
                  Reporter:
                  csev Charles Severance
                  Votes:
                  0 Vote for this issue
                  Watchers:
                  6 Start watching this issue

                    Dates

                    Created:
                    Updated:
                    Resolved:

                      Git Integration