changeset 3551:e7f1556192b3

Avoid class cast exception in FixWQCurveGenerator. flys-artifacts/trunk@5145 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Ingo Weinzierl <ingo.weinzierl@intevation.de>
date Fri, 27 Jul 2012 08:36:24 +0000
parents 38fb6b410601
children 1df6984628c3
files flys-artifacts/ChangeLog flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/QWDDateRange.java flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixWQCurveGenerator.java
diffstat 3 files changed, 18 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/flys-artifacts/ChangeLog	Fri Jul 27 06:16:19 2012 +0000
+++ b/flys-artifacts/ChangeLog	Fri Jul 27 08:36:24 2012 +0000
@@ -1,3 +1,13 @@
+2012-07-27  Ingo Weinzierl <ingo@intevation.de>
+
+	* src/main/java/de/intevation/flys/artifacts/model/QWDDateRange.java:
+	  Added method getQWD() to retrieve the QWD property.
+
+	* src/main/java/de/intevation/flys/exports/fixings/FixWQCurveGenerator.java:
+	  Avoid class cast exceptions; a QWDDateRange object is returned by WQ
+	  sector average Facet - not a QWD object. Use new getter method to
+	  retrieve the required data object.
+
 2012-07-27  Ingo Weinzierl <ingo@intevation.de>
 
 	Tagged module as '2.8.1'.
--- a/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/QWDDateRange.java	Fri Jul 27 06:16:19 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/artifacts/model/QWDDateRange.java	Fri Jul 27 08:36:24 2012 +0000
@@ -16,5 +16,9 @@
         this.qwd = qwd;
         this.dateRange = dr;
     }
+
+    public QWD getQWD() {
+        return qwd;
+    }
 }
 // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :
--- a/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixWQCurveGenerator.java	Fri Jul 27 06:16:19 2012 +0000
+++ b/flys-artifacts/src/main/java/de/intevation/flys/exports/fixings/FixWQCurveGenerator.java	Fri Jul 27 08:36:24 2012 +0000
@@ -5,6 +5,7 @@
 import de.intevation.flys.artifacts.access.FixAnalysisAccess;
 import de.intevation.flys.artifacts.model.DateRange;
 import de.intevation.flys.artifacts.model.FacetTypes;
+import de.intevation.flys.artifacts.model.QWDDateRange;
 import de.intevation.flys.artifacts.model.fixings.FixFunction;
 import de.intevation.flys.artifacts.model.fixings.FixWQCurveFacet;
 import de.intevation.flys.artifacts.model.fixings.QW;
@@ -108,7 +109,9 @@
     protected void doSectorAverageOut(ArtifactAndFacet aaf, Document doc, boolean visible) {
         logger.debug("doSectorAverageOut");
 
-        QWD qwd = (QWD)aaf.getData(context);
+        QWDDateRange qwdd = (QWDDateRange) aaf.getData(context);
+        QWD qwd = qwdd != null ? qwdd.getQWD() : null;
+
         if(qwd != null) {
             addQWSeries(new QWD[] { qwd }, aaf, doc, visible);
         }

http://dive4elements.wald.intevation.org