[PATCH] (issue1649) Better check for waterlevel data and accept wkms data
Wald Commits
scm-commit at wald.intevation.org
Mon Dec 16 16:00:26 CET 2013
# HG changeset patch
# User Andre Heinecke <aheinecke at intevation.de>
# Date 1387206010 -3600
# Node ID feb23ab736f4adaecd51ad81b841d4df2c78b9ab
# Parent 75ef6963f1c96e014c4b64bc6e4d845441f159a9
(issue1649) Better check for waterlevel data and accept wkms data
Fixes calculation of differences with old differences calculations
diff -r 75ef6963f1c9 -r feb23ab736f4 artifacts/src/main/java/org/dive4elements/river/utils/RiverUtils.java
--- a/artifacts/src/main/java/org/dive4elements/river/utils/RiverUtils.java Mon Dec 16 15:14:40 2013 +0100
+++ b/artifacts/src/main/java/org/dive4elements/river/utils/RiverUtils.java Mon Dec 16 16:00:10 2013 +0100
@@ -786,13 +786,31 @@
return null;
}
else{
- WQKms[] wqkms = (WQKms[]) flys.getWaterlevelData().
- getData();
- if (wqkms == null)
- logger.warn("not waterlevels in artifact");
- else if (wqkms.length < idx)
- logger.warn("not enough waterlevels in artifact");
- return wqkms[idx];
+ Object data = flys.getWaterlevelData(context).getData();
+
+ if (data == null) {
+ logger.error("No waterlevel Data in artifact");
+ return null;
+ }
+
+ if (data instanceof WQKms[]) {
+ WQKms[] wqkms = (WQKms[]) data;
+ if (wqkms.length < idx) {
+ logger.error("not enough waterlevels in artifact");
+ return null;
+ }
+ return wqkms[idx];
+ } else if (data instanceof WKms[]) {
+ WKms[] wkms = (WKms[]) data;
+ if (wkms.length < idx) {
+ logger.error("not enough wkms in artifact");
+ return null;
+ }
+ return wkms[idx];
+ }
+
+ logger.error("unknown Waterlevel Data.");
+ return null;
}
}
More information about the Dive4elements-commits
mailing list