changeset 9513:1722727803f7

Fixed merge problem and null pointer exception
author gernotbelger
date Mon, 01 Oct 2018 13:01:55 +0200
parents 5c1e66a3c878
children ee6508687e3f
files artifacts/src/main/java/org/dive4elements/river/artifacts/model/river/RiverInfoProvider.java
diffstat 1 files changed, 9 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/artifacts/src/main/java/org/dive4elements/river/artifacts/model/river/RiverInfoProvider.java	Mon Oct 01 12:57:10 2018 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/artifacts/model/river/RiverInfoProvider.java	Mon Oct 01 13:01:55 2018 +0200
@@ -45,15 +45,17 @@
         final List<Gauge> gauges;
         if (calcRange == null)
             gauges = river.getGauges();
-        else
+        else {
             gauges = river.determineGauges(calcRange.getMinimumDouble(), calcRange.getMaximumDouble());
 
-        // If the range starts exactly at a gauge's range end, determineGauges gets this gauge as the first in list,
-        // but we want the list to start with the next gauge, i.e. that one that starts with the calc range,
-        // therefore we remove the first one
-        // REMARK Bei abwärts kilometriertem Fluss den letzten Gauge in der Liste prüfen (Ende)/entfernen
-        if ((gauges.size() >= 2) && (Math.abs(gauges.get(0).getRange().getB().doubleValue() - calcRange.getMinimumDouble()) < 0.0001))
-            gauges.remove(0);
+            // If the range starts exactly at a gauge's range end, determineGauges gets this gauge as the first in list,
+            // but we want the list to start with the next gauge, i.e. that one that starts with the calc range,
+            // therefore we remove the first one
+            // REMARK Bei abwärts kilometriertem Fluss den letzten Gauge in der Liste prüfen (Ende)/entfernen
+            if ((gauges.size() >= 2) && (Math.abs(gauges.get(0).getRange().getB().doubleValue() - calcRange.getMinimumDouble()) < 0.0001))
+                gauges.remove(0);
+        }
+
         final GaugeIndex gaugeIndex = new GaugeIndex(gauges);
 
         final String notinrange = Resources.getMsg(context.getMeta(), CSV_NOT_IN_GAUGE_RANGE, CSV_NOT_IN_GAUGE_RANGE);
@@ -111,13 +113,6 @@
         return gauge == null ? this.notinrange : gauge.getName();
     }
 
-    private String findGauge(final double km, final boolean allGauges) {
-        // REMARK: access the gauge once only during calculation
-        final Gauge gauge = getGauge(km, allGauges);
-
-        return gauge == null ? this.notinrange : gauge.getName();
-    }
-
     public Gauge getGauge(final double km) {
 
         // REMARK: using same logic as in WaterlevelExporter here

http://dive4elements.wald.intevation.org