changeset 6983:93e7f947f6fa

flys/issue1417 Be more fault tolerant if a river has no flood plain.
author Sascha L. Teichmann <teichmann@intevation.de>
date Tue, 10 Sep 2013 17:48:48 +0200
parents 5149e6e5c2eb
children 77f48c104d23
files artifacts/src/main/java/org/dive4elements/river/artifacts/states/FloodMapState.java
diffstat 1 files changed, 12 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/states/FloodMapState.java	Tue Sep 10 15:22:59 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/states/FloodMapState.java	Tue Sep 10 17:48:48 2013 +0200
@@ -882,11 +882,22 @@
 
         Floodplain plain = Floodplain.getFloodplain(river);
 
+        if (plain == null) {
+            logger.debug("No flood plain for river '" + river + "'");
+            return;
+        }
+
+        Polygon polygon = plain.getGeom();
+        if (polygon == null) {
+            logger.warn("Floodplain has no geometry.");
+            return;
+        }
+
         SimpleFeatureType ft = GeometryUtils.buildFeatureType(
             "talaue", srs, Polygon.class);
 
         SimpleFeatureBuilder builder = new SimpleFeatureBuilder(ft);
-        builder.add(plain.getGeom());
+        builder.add(polygon);
 
         FeatureCollection collection = FeatureCollections.newCollection();
         collection.add(builder.buildFeature("0"));

http://dive4elements.wald.intevation.org