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

Velocity > fix IndexOutOfBoundsException possibilities in PagedResourceActionII

    Details

    • Type: Bug
    • Status: RESOLVED
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.8 [Tentative], 11.5 [Tentative], 12.2, 19.0
    • Fix Version/s: 19.0
    • Component/s: Kernel, Velocity
    • Labels:
      None
    • Test Plan:
      Hide

      Please add a Test Plan here.

      Show
      Please add a Test Plan here.

      Description

      All Velocity tools using PagedResourceActionII which have a table of data, a paginator component and one or more filter components (search, group/section filter, etc.) are susceptible to generating IndexOutOfBoundsExceptions. The logic to validate page number and page size is slightly flawed.

      An example can be seen in Assignments:

      1. Ensure you have 6 or more students/access users in your site
      2. Create a group with only 1 student/access user
      3. In Assignments, ensure there is at least 1 assignment created (bare bones assignment is fine)
      4. Go to 'Grade Report'
      5. Use the paginator to move to any page other than the first (change page size if necessary)
      6. Use the filter drop down to select the group you created in step 2
      7. Notice bug report is shown in the UI, and a stacktrace is thrown in the logs for an IndexOutOfBoundsException:
      Caused by: java.lang.IndexOutOfBoundsException: toIndex = 201
              at java.util.ArrayList.subListRangeCheck(ArrayList.java:1012)
              at java.util.ArrayList.subList(ArrayList.java:1004)
              at org.sakaiproject.assignment.tool.AssignmentAction.readResourcesPage(AssignmentAction.java:11946)
              at org.sakaiproject.cheftool.PagedResourceActionII.prepPage(PagedResourceActionII.java:376)
              at org.sakaiproject.assignment.tool.AssignmentAction.build_instructor_report_submissions(AssignmentAction.java:4796)
              at org.sakaiproject.assignment.tool.AssignmentAction.buildMainPanelContext(AssignmentAction.java:1267)
              ... 54 more
      

      This bug has been long standing, and is reproducible as far back as 2.9.1 (probably earlier). If the requested (current) page number is out of range of the list size due to a filter being applied, the validation logic should reset to the first page in the list.

        Gliffy Diagrams

          Attachments

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Git Source Code