Uploaded image for project: 'CRISP'
  1. CRISP
  2. CRISP-85

IllegalArgumentException on ResourceCollectionUtils#createSubList

    XMLWordPrintable

    Details

    • Similar issues:
    • Processed by team:
      Solution Team
    • Sprint:
      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

            • Assignee:
              Unassigned
              Reporter:
              eperez Eduardo Perez
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: