[PATCH] Fixed exception in wq csv export (raising error_no_export_found) in cases when the calc range starts outside any gauge range

Wald Commits scm-commit at wald.intevation.org
Tue Oct 16 16:42:42 CEST 2018


# HG changeset patch
# User mschaefer
# Date 1539700942 -7200
# Node ID aa23225fd85fe6f1c29ebf7ab372688134af1fdf
# Parent  3fa8551c3d1b154ce3cae0113026824e267ec3c0
Fixed exception in wq csv export (raising error_no_export_found) in cases when the calc range starts outside any gauge range

diff -r 3fa8551c3d1b -r aa23225fd85f artifacts/src/main/java/org/dive4elements/river/exports/WaterlevelExporter.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/WaterlevelExporter.java	Fri Oct 12 18:49:38 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/WaterlevelExporter.java	Tue Oct 16 16:42:22 2018 +0200
@@ -607,10 +607,16 @@
 
         final List<Gauge> gauges = RiverUtils.getGauges(flys);
 
-        final Gauge gauge = rangeAccess.getRiver().determineRefGauge(rangeAccess.getKmRange(), rangeAccess.isRange());
+        Gauge gauge = rangeAccess.getRiver().determineRefGauge(rangeAccess.getKmRange(), rangeAccess.isRange());
+
+        // REMARK gauge may be null when rangeAccess starts outside any gauge range
+        if (gauge == null)
+            gauge = rangeAccess.getRiver().determineRefGauge(wqkms.getKms(), rangeAccess.isRange());
 
         final String gaugeName = gauge.getName(); // RANDOMLY CHRASHES HERE, gauge is randomly null (especially on heavy load) - on production system as well
                                                   // (it seems to)
+                                                  // REMARK "randomly" crashes: see REMARK above
+
         String desc = "";
         final String notinrange = msg(CSV_NOT_IN_GAUGE_RANGE, DEFAULT_CSV_NOT_IN_GAUGE_RANGE);
 


More information about the Dive4Elements-commits mailing list