diff --git a/src/main/java/org/opengis/cite/iso19142/util/DataSampler.java b/src/main/java/org/opengis/cite/iso19142/util/DataSampler.java index 006cd4d4..9fc04e2e 100644 --- a/src/main/java/org/opengis/cite/iso19142/util/DataSampler.java +++ b/src/main/java/org/opengis/cite/iso19142/util/DataSampler.java @@ -110,6 +110,7 @@ public Set selectRandomFeatureIdentifiers(QName featureType, } int sampleSize = result.size(); Random random = new Random(); + numId = numId > sampleSize ? sampleSize : numId; while (idSet.size() < numId) { int randomInt = random.nextInt(sampleSize); idSet.add(result.itemAt(randomInt).getStringValue());