# HG changeset patch # User Tom Gottfried # Date 1376380275 -7200 # Node ID 1d60614c1059460898abfb14b9363e47e4e96a1f # Parent 4ad2b530dbba6d6b0ad7bbe32fcc76965945992a WstParser: warn only once if no unit comment is found diff -r 4ad2b530dbba -r 1d60614c1059 backend/src/main/java/org/dive4elements/river/importer/parsers/WstParser.java --- 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 kms = new HashSet(); @@ -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