[Dive4elements-commits] [PATCH 2 of 7] CrossSectionWaterLineFacet: Guard class cast

Wald Commits scm-commit at wald.intevation.org
Wed Nov 14 13:43:23 CET 2012


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1352892313 -3600
# Node ID 719680a282e592dbe512043a317a70b0399a6ea2
# Parent  6d3426aba65d9bc5e443830d6a22237aa8b82747
CrossSectionWaterLineFacet: Guard class cast.

diff -r 6d3426aba65d -r 719680a282e5 flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/CrossSectionWaterLineFacet.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/CrossSectionWaterLineFacet.java	Wed Nov 14 12:23:56 2012 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/CrossSectionWaterLineFacet.java	Wed Nov 14 12:25:13 2012 +0100
@@ -71,6 +71,10 @@
         if (nextKm == null)
             nextKm = new Double(-1d);
 
+        if (!(artifact instanceof WaterLineArtifact)) {
+            logger.error("CrossSectionWaterLineFacet needs WaterLineArtifact");
+            return new Lines.LineData(new double[][] {}, 0d,0d);
+        }
         WaterLineArtifact lineArtifact = (WaterLineArtifact) artifact;
 
         if (crossSection != null) {


More information about the Dive4elements-commits mailing list