Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-39391

Support for from index greater than the actual array size during pagination

      In range notation during pagination, if the from index exceeds the actual array size, Jenkins throws an exception. Can't it return an empty response or something similar instead, so that we know when to stop?

      For example, suppose a Jenkins server has 10840 jobs and we want to get all the jobs' details. We keep incrementing the lower bound according to page size (say 1000). Eventually, we hit:
      http://server/api/json?tree=jobs[name,url,builds[number,url]]

      {11000,12000}

      which throws the following exception:
      Caused by: java.lang.IllegalArgumentException: fromIndex(11000) > toIndex(10841)

          [JENKINS-39391] Support for from index greater than the actual array size during pagination

          Oleg Nenashev added a comment -

          Yes, makes sense to be more robust here

          Oleg Nenashev added a comment - Yes, makes sense to be more robust here

          Li Ke added a comment -

          oleg_nenashev Seems like we need to change stapler. 

          Li Ke added a comment - oleg_nenashev Seems like we need to change stapler. 

            Unassigned Unassigned
            pxk5958 Pratith Kanagaraj
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: