# HG changeset patch # User Ingo Weinzierl # Date 1347942033 0 # Node ID aed7aba93718033c201cdf14a598db88d735906b # Parent 686b5a5f9f2513f0b329a5d1148f8ce2fc30229b Improved logging and stabilized minfo import. flys-backend/trunk@5500 c6561f87-3c4e-4783-a992-168aeb5c3f6f diff -r 686b5a5f9f25 -r aed7aba93718 flys-backend/ChangeLog --- a/flys-backend/ChangeLog Mon Sep 17 12:48:59 2012 +0000 +++ b/flys-backend/ChangeLog Tue Sep 18 04:20:33 2012 +0000 @@ -1,3 +1,11 @@ +2012-09-18 Ingo Weinzierl + + * src/main/java/de/intevation/flys/importer/ImportSedimentDensity.java, + src/main/java/de/intevation/flys/importer/parsers/BedHeightParser.java, + src/main/java/de/intevation/flys/importer/parsers/SedimentDensityParser.java, + src/main/java/de/intevation/flys/importer/parsers/WaterlevelDifferencesParser.java: + Some litte logging improvements and be more tolerant with exceptions. + 2012-09-17 Ingo Weinzierl Taggd RELEASE 2.9.1 diff -r 686b5a5f9f25 -r aed7aba93718 flys-backend/src/main/java/de/intevation/flys/importer/ImportSedimentDensity.java --- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportSedimentDensity.java Mon Sep 17 12:48:59 2012 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportSedimentDensity.java Tue Sep 18 04:20:33 2012 +0000 @@ -78,6 +78,16 @@ public SedimentDensity getPeer(River river) { log.info("get peer"); + + if (depth == null) { + log.warn("cannot store sediment density '" + description + "': no depth"); + return null; + } + + if (unit == null) { + log.warn("cannot store sediment density '" + description + "': no unit"); + return null; + } if (peer == null) { Session session = ImporterSession.getInstance().getDatabaseSession(); diff -r 686b5a5f9f25 -r aed7aba93718 flys-backend/src/main/java/de/intevation/flys/importer/parsers/BedHeightParser.java --- a/flys-backend/src/main/java/de/intevation/flys/importer/parsers/BedHeightParser.java Mon Sep 17 12:48:59 2012 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/parsers/BedHeightParser.java Tue Sep 18 04:20:33 2012 +0000 @@ -256,8 +256,10 @@ return true; } catch (NumberFormatException e) { - log.warn("BHP: Error while parsing sounding width!", e); + log.warn("BHP: Error while parsing sounding width: " + line, e); + log.warn("-> Set default value '0'"); } + obj.setSoundingWidth(0); } return false; diff -r 686b5a5f9f25 -r aed7aba93718 flys-backend/src/main/java/de/intevation/flys/importer/parsers/SedimentDensityParser.java --- a/flys-backend/src/main/java/de/intevation/flys/importer/parsers/SedimentDensityParser.java Mon Sep 17 12:48:59 2012 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/parsers/SedimentDensityParser.java Tue Sep 18 04:20:33 2012 +0000 @@ -117,6 +117,8 @@ String lo = m.group(1); String up = m.group(2); String unit = m.group(4); + + log.info("Found sediment density depth: " + lo + " - " + up + " " + unit); try { ImportDepth depth = new ImportDepth( @@ -133,6 +135,9 @@ log.warn("Error while parsing numbers in: '" + line + "'"); } } + else { + log.debug("Meta line doesn't contain depth information: " + line); + } return false; } diff -r 686b5a5f9f25 -r aed7aba93718 flys-backend/src/main/java/de/intevation/flys/importer/parsers/WaterlevelDifferencesParser.java --- a/flys-backend/src/main/java/de/intevation/flys/importer/parsers/WaterlevelDifferencesParser.java Mon Sep 17 12:48:59 2012 +0000 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/parsers/WaterlevelDifferencesParser.java Tue Sep 18 04:20:33 2012 +0000 @@ -153,7 +153,14 @@ Double station = nf.parse(cols[0]).doubleValue(); for (int i = 0; i < columns.length; i++) { - String value = cols[i+1]; + int idx = i+1; + + if (idx >= cols.length) { + log.warn("Insufficient column numbers: " + line); + continue; + } + + String value = cols[idx]; try { columns[i].addValue(new ImportWaterlevelDifferenceValue(