[PATCH] (issue1071) Handle the case where no MeasurementStation exists

Wald Commits scm-commit at wald.intevation.org
Fri Oct 18 15:30:48 CEST 2013


# HG changeset patch
# User Andre Heinecke <aheinecke at intevation.de>
# Date 1382103044 -7200
# Node ID d8d0caaf60a2a5b5d1755754176cafc77c9c079d
# Parent  e07dc8854a8f2fbdcefb4b487b19a8eff233f026
(issue1071) Handle the case where no MeasurementStation exists

    Fixes SQRelation Export at the Oder.

diff -r e07dc8854a8f -r d8d0caaf60a2 artifacts/src/main/java/org/dive4elements/river/artifacts/access/SQRelationAccess.java
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/access/SQRelationAccess.java	Thu Oct 17 18:56:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/access/SQRelationAccess.java	Fri Oct 18 15:30:44 2013 +0200
@@ -101,7 +101,7 @@
         }
         List<MeasurementStation> candidates = MeasurementStation.getStationsAtKM(
                 getRiverName(), getLocation());
-        if (candidates != null) {
+        if (candidates != null && !candidates.isEmpty()) {
             // Just take the first one as we only use the name
             // and that "should" be unique at the location
             measurementStation = candidates.get(0);
diff -r e07dc8854a8f -r d8d0caaf60a2 artifacts/src/main/java/org/dive4elements/river/exports/sq/SQRelationExporter.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/sq/SQRelationExporter.java	Thu Oct 17 18:56:44 2013 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/sq/SQRelationExporter.java	Fri Oct 18 15:30:44 2013 +0200
@@ -260,12 +260,16 @@
 
         if (measurementStationName != null) {
             source.addMetaData("msName", measurementStationName);
+        } else {
+            source.addMetaData("msName", "");
         }
 
         String measurementStationGaugeName = access.getMeasurementStationGaugeName();
 
         if (measurementStationGaugeName != null) {
             source.addMetaData("msGauge", measurementStationGaugeName);
+        } else {
+            source.addMetaData("msGauge", "");
         }
 
     }


More information about the Dive4elements-commits mailing list