[Dive4elements-commits] [PATCH 1 of 2] WaterlevelFacet: Avoid classcastexceptions

Wald Commits scm-commit at wald.intevation.org
Wed Mar 27 09:55:16 CET 2013


# HG changeset patch
# User Felix Wolfsteller <felix.wolfsteller at intevation.de>
# Date 1364374144 -3600
# Node ID 70e0732bd4dd066741f7fe479ad65af2470ea940
# Parent  3d7e552cc39608169bbb01aafd31f20ae1e0f170
WaterlevelFacet: Avoid classcastexceptions.

diff -r 3d7e552cc396 -r 70e0732bd4dd flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WaterlevelFacet.java
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WaterlevelFacet.java	Tue Mar 26 22:29:55 2013 +0100
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/WaterlevelFacet.java	Wed Mar 27 09:49:04 2013 +0100
@@ -38,7 +38,13 @@
     protected WQKms [] getWQKms(CalculationResult res) {
         if (res.getData() instanceof ExtremeResult)
             return ((ExtremeResult) res.getData()).getWQKms();
-        return (WQKms []) res.getData();
+        else if (res.getData() instanceof WQKms[]) {
+            return (WQKms []) res.getData();
+        }
+        else {
+            logger.error("WaterlevelFacet got wrong data type " + res.getData());
+            return null;
+        }
     }
 
     /**


More information about the Dive4elements-commits mailing list