Mercurial > dive4elements > river
changeset 3940:aed7aba93718
Improved logging and stabilized minfo import.
flys-backend/trunk@5500 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Ingo Weinzierl <ingo.weinzierl@intevation.de> |
---|---|
date | Tue, 18 Sep 2012 04:20:33 +0000 |
parents | 686b5a5f9f25 |
children | 3de4ac5ccee8 |
files | flys-backend/ChangeLog flys-backend/src/main/java/de/intevation/flys/importer/ImportSedimentDensity.java flys-backend/src/main/java/de/intevation/flys/importer/parsers/BedHeightParser.java flys-backend/src/main/java/de/intevation/flys/importer/parsers/SedimentDensityParser.java flys-backend/src/main/java/de/intevation/flys/importer/parsers/WaterlevelDifferencesParser.java |
diffstat | 5 files changed, 34 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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 <ingo@intevation.de> + + * 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 <ingo@intevation.de> Taggd RELEASE 2.9.1
--- 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();
--- 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;
--- 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; }
--- 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(