Uploaded image for project: '[Read Only] - CRISP'
  1. [Read Only] - CRISP
  2. CRISP-85

IllegalArgumentException on ResourceCollectionUtils#createSubList

    XMLWordPrintable

Details

    • Projects team Sprint 17

    Description

      There is a situation when the resourceCollectionUtils#createSubList is called with the following parameters that a IllegalArgumentException is thrown:

      • Empty List
      • 0 as offset
      • -1 as limit

      That happens because the first if clause of the method is true:

      detects offset >= source.size()

      I think that the two first if statements should be swapped, on that case it would return the "full" empty list:

      if ((offset == 0 && limit < 0) || (offset == 0 && limit == source.size())) {
       return source;
      }
      
      if (offset < 0 || offset >= source.size()) {
       throw new IllegalArgumentException("Invalid offset: " + offset + " (size = " + source.size() + ")");
      }

      Attachments

        Activity

          People

            Unassigned Unassigned
            eperez Eduardo Perez (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: