changeset 8682:5102733c4567

issue1755 Prevent out of bounds access when there is no data If there is no data it will default to the complete river. In the following overview you can then see that there is no data. Better then a "Error changing state".
author Andre Heinecke <andre.heinecke@intevation.de>
date Mon, 13 Apr 2015 11:03:00 +0200
parents 1f878c82262f
children cfafe5764509
files artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/BedQualityDistanceSelect.java
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/BedQualityDistanceSelect.java	Fri Apr 10 17:47:00 2015 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/minfo/BedQualityDistanceSelect.java	Mon Apr 13 11:03:00 2015 +0200
@@ -65,6 +65,10 @@
         }
 
         KMIndex<List<Date>> entries = overview.filter(BedOverview.ACCEPT);
+        if (entries.size() == 0) {
+            log.warn("No data found for river '" + access.getRiverName() + "'");
+            return ele;
+        }
         entries.sort();
 
         if (data.getName().equals("ld_from")) {

http://dive4elements.wald.intevation.org