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

IllegalArgumentException when clicking 'preview' or 'print' while editing a published assessment

    XMLWordPrintable

    Details

    • 10 status:
      Verified
    • Previous Issue Keys:
      SAM-2690
    • Test Plan:
      Hide

      Steps to reproduce:

      1) Create and publish an assessment
      2) From the author index, select 'Edit' from the drop down for any published assessment
      3) Click 'Preview' or 'Print' from the options bar on the top of the page
      4) Notice stack trace
      5) From the author index, select 'Preview' or 'Print' from the drop down (rather than 'Edit'), as a short cut to the desired functionality
      6) Notice that this code path will always work, rather than producing the stack trace experienced when using the 'Edit' UI.

      Show
      Steps to reproduce: 1) Create and publish an assessment 2) From the author index, select 'Edit' from the drop down for any published assessment 3) Click 'Preview' or 'Print' from the options bar on the top of the page 4) Notice stack trace 5) From the author index, select 'Preview' or 'Print' from the drop down (rather than 'Edit'), as a short cut to the desired functionality 6) Notice that this code path will always work, rather than producing the stack trace experienced when using the 'Edit' UI.

      Description

      When editing a published quiz, selecting 'Preview' or 'Print' will generate a stack trace (attached). This bug is caused by the code introduced in SAM-2533, coupled with the introduction of the ability to edit published assessments.

      Previous to this new feature, the editAssessment.jsp was designed to be used only with unpublished assessments (working copies), and therefor had no knowledge of (or ability to get) a published assessment's ID.

      The root cause of the problem, is that when editing a published assessment, the parameter 'assessmentId' is passed in. This ID is ambiguous in a sense, because the IDs of assessments can be shared. IE, a published assessment's ID in one site can very likely be the exact same as a published or working copy's ID in a different site.

      In the case of editing a published assessment, and then clicking the 'Preview' or 'Print' links, an 'assessmentId' parameter is passed into the corresponding listener (BeginDeliveryActionListener), however the 'publishedId' parameter is not. So in this case, the code added for SAM-2533 is run, finds the 'publishedId' parameter to be empty, and checks permissions for the 'assessmentId' for the current site. There is a high degree of likelihood that the 'assessmentId' (working copy ID) is the same as another assessment ID in another site (or it simply doesn't belong to or doesn't exist in the current site), in which case the authorization check will fail, and the IllegalArgumentException is thrown.

      The solution (without duplicating the functionality of editAssessment.jsp for something like editPublishedAssessment.jsp, or completely refactoring editAssignment.jsp to be aware of both AssessmentBean and PublishedAssessmentBean and when to use one over the other), is to simply pass the known published assessment ID down the workflow (in only the cases where you're selecting to edit a published assessment), as that ID is known upon clicking the 'Edit' choice in the drop down for a particular published assessment.

        Gliffy Diagrams

          Zeplin

            Attachments

              Activity

                People

                Assignee:
                bjones86 Brian Jones
                Reporter:
                bjones86 Brian Jones
                Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:

                    Git Integration