Mercurial > dive4elements > river
changeset 7380:d8d0caaf60a2
(issue1071) Handle the case where no MeasurementStation exists
Fixes SQRelation Export at the Oder.
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Fri, 18 Oct 2013 15:30:44 +0200 |
parents | e07dc8854a8f |
children | b7e82468299a |
files | artifacts/src/main/java/org/dive4elements/river/artifacts/access/SQRelationAccess.java artifacts/src/main/java/org/dive4elements/river/exports/sq/SQRelationExporter.java |
diffstat | 2 files changed, 5 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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);
--- 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", ""); } }