Details
-
Bug
-
Status: Closed
-
Normal
-
Resolution: Fixed
-
None
-
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() + ")"); }