changeset 6819:1d60614c1059 double-precision

WstParser: warn only once if no unit comment is found
author Tom Gottfried <tom.gottfried@intevation.de>
date Tue, 13 Aug 2013 09:51:15 +0200
parents 4ad2b530dbba
children 827da1952ce2
files backend/src/main/java/org/dive4elements/river/importer/parsers/WstParser.java
diffstat 1 files changed, 9 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/backend/src/main/java/org/dive4elements/river/importer/parsers/WstParser.java	Mon Aug 12 18:14:12 2013 +0200
+++ b/backend/src/main/java/org/dive4elements/river/importer/parsers/WstParser.java	Tue Aug 13 09:51:15 2013 +0200
@@ -141,9 +141,11 @@
 
             boolean columnHeaderChecked = false;
 
-	    /* Default string for altitude reference 
-	     * if none is found in WST-file*/
+            /* Default string for altitude reference 
+             * if none is found in WST-file.
+             * Use in case no unit comment is found in file */
             String einheit = "m ΓΌ. unbekannte Referenz";
+            boolean unitFound = false;
 
             HashSet<BigDecimal> kms = new HashSet<BigDecimal>();
 
@@ -262,10 +264,9 @@
                         m = UNIT.matcher(units[0]);
                         einheit = m.matches() ? m.group(1) : units[0];
                         log.debug("unit: " + einheit);
+                        unitFound = true;
                     }
-		    else {
-			log.warn("no unit and height reference found. Using default.");
-		    }
+
                     continue;
                 }
 
@@ -374,6 +375,9 @@
 
             } // for all lines in WST file
 
+            if (!unitFound) {
+                log.warn("no unit and height reference found. Using default.");
+            }
             wst.setUnit(new ImportUnit(einheit));
 
             if (kmHist1 != null && kmHist2 != null

http://dive4elements.wald.intevation.org