[PATCH 8 of 9] Saveguard range access in case an artifact has no range

Wald Commits scm-commit at wald.intevation.org
Thu Sep 26 12:57:06 CEST 2013


# HG changeset patch
# User Andre Heinecke <aheinecke at intevation.de>
# Date 1380190942 -7200
# Node ID 81416a62fa576f7acb731930ce9a2eeba2d18bfc
# Parent  2fd238b681a9cd4c596a9a9593df41132748c44f
Saveguard range access in case an artifact has no range

diff -r 2fd238b681a9 -r 81416a62fa57 artifacts/src/main/java/org/dive4elements/river/exports/LongitudinalSectionGenerator2.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/LongitudinalSectionGenerator2.java	Thu Sep 26 12:22:01 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/LongitudinalSectionGenerator2.java	Thu Sep 26 12:22:22 2013 +0200
@@ -71,16 +71,20 @@
         }
         else if (getXBounds(0) == null && getDomainAxisRange() == null) {
             RangeAccess access = new RangeAccess(artifact);
-            context.putContextValue("startkm", access.getFrom());
-            context.putContextValue("endkm", access.getTo());
+            if (access.hasFrom() && access.hasTo()) {
+                context.putContextValue("startkm", access.getFrom());
+                context.putContextValue("endkm", access.getTo());
+            }
         }
         else if (getXBounds(0) == null && getDomainAxisRange() != null){
             RangeAccess access = new RangeAccess(artifact);
-            Bounds b = new DoubleBounds(access.getFrom(), access.getTo());
-            Bounds bounds =
-                calculateZoom(b, getDomainAxisRange());
-            context.putContextValue("startkm", bounds.getLower());
-            context.putContextValue("endkm", bounds.getUpper());
+            if (access.hasFrom() && access.hasTo()) {
+                Bounds b = new DoubleBounds(access.getFrom(), access.getTo());
+                Bounds bounds =
+                    calculateZoom(b, getDomainAxisRange());
+                context.putContextValue("startkm", bounds.getLower());
+                context.putContextValue("endkm", bounds.getUpper());
+            }
         }
         super.doOut(bundle, theme, visible);
     }


More information about the Dive4elements-commits mailing list