[PATCH] wUnit might be null

Wald Commits scm-commit at wald.intevation.org
Thu Oct 2 09:42:41 CEST 2014


# HG changeset patch
# User Tom Gottfried <tom at intevation.de>
# Date 1412235732 -7200
# Node ID 3508d625092f350f6d76c23e889c552799914ce8
# Parent  839032ac152359e872acea8366fe2d70b936a8e5
wUnit might be null.

diff -r 839032ac1523 -r 3508d625092f artifacts/src/main/java/org/dive4elements/river/exports/ComputedDischargeCurveExporter.java
--- a/artifacts/src/main/java/org/dive4elements/river/exports/ComputedDischargeCurveExporter.java	Wed Oct 01 15:54:47 2014 +0200
+++ b/artifacts/src/main/java/org/dive4elements/river/exports/ComputedDischargeCurveExporter.java	Thu Oct 02 09:42:12 2014 +0200
@@ -165,7 +165,7 @@
         RangeAccess access = new RangeAccess((D4EArtifact)master);
         double[] km = access.getLocations();
         // If we are not at gauge (cm) use the river unit
-        String realUnit = wUnit.equals("cm") ? "cm" : riverUnit;
+        String realUnit = "cm".equals(wUnit) ? "cm" : riverUnit;
         String header =
             msg(CSV_W_HEADER, DEFAULT_CSV_W_HEADER, new Object[] {realUnit});
 
@@ -182,7 +182,7 @@
      * @return the number formatter for W values.
      */
     protected NumberFormat getWFormatter() {
-        if (wUnit.equals("cm")) {
+        if ("cm".equals(wUnit)) {
             return Formatter.getFormatter(context, 0, 0);
         }
         return Formatter.getComputedDischargeW(context);
@@ -254,7 +254,7 @@
 
         source.addMetaData("date", df.format(new Date()));
 
-        source.addMetaData("wUnit", wUnit.equals("cm") ? "cm" : riverUnit);
+        source.addMetaData("wUnit", "cm".equals(wUnit) ? "cm" : riverUnit);
 
         RangeAccess rangeAccess = new RangeAccess(flys);
         double[] kms = rangeAccess.getKmRange();


More information about the Dive4Elements-commits mailing list