[PATCH] flys/issue1417 Be more fault tolerant if a river has no flood plain

Wald Commits scm-commit at wald.intevation.org
Tue Sep 10 17:48:58 CEST 2013


# HG changeset patch
# User Sascha L. Teichmann <teichmann at intevation.de>
# Date 1378828128 -7200
# Node ID 93e7f947f6fa309ff148f51b606cdbc0a0bf4f73
# Parent  5149e6e5c2ebdb815b543dd7250648b9bc2d85f0
flys/issue1417 Be more fault tolerant if a river has no flood plain.

diff -r 5149e6e5c2eb -r 93e7f947f6fa artifacts/src/main/java/org/dive4elements/river/artifacts/states/FloodMapState.java
--- 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"));


More information about the Dive4elements-commits mailing list