diff --git a/jetty-util/src/main/java/org/eclipse/jetty/util/resource/ResourceCollection.java b/jetty-util/src/main/java/org/eclipse/jetty/util/resource/ResourceCollection.java index 87321e19412d..920506e8b2a5 100644 --- a/jetty-util/src/main/java/org/eclipse/jetty/util/resource/ResourceCollection.java +++ b/jetty-util/src/main/java/org/eclipse/jetty/util/resource/ResourceCollection.java @@ -202,13 +202,18 @@ public void setResourcesAsCSV(String csvResources) throws IOException throw new IllegalArgumentException("CSV String is blank"); } - List res = new ArrayList<>(); - for (Resource resource : Resource.fromList(csvResources, false)) + List resources = Resource.fromList(csvResources, false); + if (resources.isEmpty()) + { + throw new IllegalArgumentException("CSV String contains no entries"); + } + List ret = new ArrayList<>(); + for (Resource resource : resources) { assertResourceValid(resource); - res.add(resource); + ret.add(resource); } - setResources(res); + setResources(ret); } /**