# HG changeset patch # User Sascha L. Teichmann # Date 1365023771 -7200 # Node ID 12f4d088f088db2c3be7ced7ab28e4434f05d4c6 # Parent 732a8bd446502999d046879d08788be2b9385d91 WST importer: Cosmetics. diff -r 732a8bd44650 -r 12f4d088f088 flys-backend/src/main/java/de/intevation/flys/importer/parsers/WstParser.java --- a/flys-backend/src/main/java/de/intevation/flys/importer/parsers/WstParser.java Wed Apr 03 21:02:17 2013 +0200 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/parsers/WstParser.java Wed Apr 03 23:16:11 2013 +0200 @@ -105,8 +105,10 @@ BigDecimal [] aktAbfluesse = null; BigDecimal [] firstAbfluesse = null; - BigDecimal minKm = MAX_RANGE; - BigDecimal maxKm = MIN_RANGE; + BigDecimal minKm = MAX_RANGE; + BigDecimal maxKm = MIN_RANGE; + BigDecimal kmHist1 = null; + BigDecimal kmHist2 = null; boolean columnHeaderChecked = false; @@ -114,8 +116,6 @@ HashSet kms = new HashSet(); - BigDecimal kmHist1 = null, kmHist2 = null; - while ((input = in.readLine()) != null) { String line = input; if (first) { // fetch number of columns @@ -147,12 +147,10 @@ parseLineAsDouble(line, columnCount, false, true); if (aktAbfluesse != null) { - if (kmHist1 != null && kmHist2 != null) { - if (kmHist1.compareTo(kmHist2) < 0) { - log.debug("swapped"); - BigDecimal t = minKm; minKm = maxKm; maxKm = t; - } - } + if (kmHist1 != null && kmHist2 != null + && kmHist1.compareTo(kmHist2) < 0) { + BigDecimal t = minKm; minKm = maxKm; maxKm = t; + } addInterval(minKm, maxKm, aktAbfluesse); minKm = MAX_RANGE; maxKm = MIN_RANGE; @@ -280,8 +278,8 @@ continue; } - kmHist2 = kmHist1; - kmHist1 = kaem; + kmHist2 = kmHist1; + kmHist1 = kaem; if (kaem.compareTo(minKm) < 0) { minKm = kaem; @@ -330,9 +328,11 @@ } // for all lines in WST file wst.setUnit(new ImportUnit(einheit)); - if (kmHist1.compareTo(kmHist2) < 0) { - BigDecimal t = minKm; minKm = maxKm; maxKm = t; - } + + if (kmHist1 != null && kmHist2 != null + && kmHist1.compareTo(kmHist2) < 0) { + BigDecimal t = minKm; minKm = maxKm; maxKm = t; + } addInterval(minKm, maxKm, aktAbfluesse); fixRangesOrder();