Issue #5133 - Fixing ResourceCollection(String) when no entries provided.

Signed-off-by: Joakim Erdfelt <joakim.erdfelt@gmail.com>
This commit is contained in:
Joakim Erdfelt 2020-08-20 13:35:48 -05:00
parent f881a1a2fe
commit b35c4332b2
No known key found for this signature in database
GPG Key ID: 2D0E1FB8FE4B68B4
1 changed files with 9 additions and 4 deletions

View File

@ -202,13 +202,18 @@ public class ResourceCollection extends Resource
throw new IllegalArgumentException("CSV String is blank"); throw new IllegalArgumentException("CSV String is blank");
} }
List<Resource> res = new ArrayList<>(); List<Resource> resources = Resource.fromList(csvResources, false);
for (Resource resource : Resource.fromList(csvResources, false)) if (resources.isEmpty())
{
throw new IllegalArgumentException("CSV String contains no entries");
}
List<Resource> ret = new ArrayList<>();
for (Resource resource : resources)
{ {
assertResourceValid(resource); assertResourceValid(resource);
res.add(resource); ret.add(resource);
} }
setResources(res); setResources(ret);
} }
/** /**