[Dive4elements-commits] [PATCH 2 of 2] Importer: Log an error if parsing a STA file failed

Wald Commits scm-commit at wald.intevation.org
Wed May 8 17:52:59 CEST 2013


# HG changeset patch
# User Sascha L. Teichmann <teichmann at intevation.de>
# Date 1368028374 -7200
# Node ID c7951390fd5862ba12e9a96587a1c080c859c707
# Parent  5de1b9faebf5d3b5bc0af1e9eca8ef42b8db1bed
Importer: Log an error if parsing a STA file failed.

diff -r 5de1b9faebf5 -r c7951390fd58 backend/src/main/java/org/dive4elements/river/importer/ImportGauge.java
--- a/backend/src/main/java/org/dive4elements/river/importer/ImportGauge.java	Wed May 08 17:12:48 2013 +0200
+++ b/backend/src/main/java/org/dive4elements/river/importer/ImportGauge.java	Wed May 08 17:52:54 2013 +0200
@@ -163,7 +163,9 @@
 
     public void parseDependencies() throws IOException {
         StaFileParser sfp = new StaFileParser();
-        sfp.parse(this);
+        if (!sfp.parse(this)) {
+            log.error("Parsing STA file failed.");
+        }
 
         AtFileParser afp = new AtFileParser();
         setDischargeTable(afp.parse(getAtFile()));
@@ -223,19 +225,25 @@
 
         Gauge gauge = getPeer(river);
 
-        log.info("store main value types");
-        for (ImportMainValueType mainValueType: mainValueTypes) {
-            mainValueType.getPeer();
+        if (mainValueTypes != null) {
+            log.info("store main value types");
+            for (ImportMainValueType mainValueType: mainValueTypes) {
+                mainValueType.getPeer();
+            }
         }
 
-        log.info("store named main values");
-        for (ImportNamedMainValue namedMainValue: namedMainValues) {
-            namedMainValue.getPeer();
+        if (namedMainValues != null) {
+            log.info("store named main values");
+            for (ImportNamedMainValue namedMainValue: namedMainValues) {
+                namedMainValue.getPeer();
+            }
         }
 
-        log.info("store main values");
-        for (ImportMainValue mainValue: mainValues) {
-            mainValue.getPeer(river);
+        if (mainValues != null) {
+            log.info("store main values");
+            for (ImportMainValue mainValue: mainValues) {
+                mainValue.getPeer(river);
+            }
         }
 
         storeDischargeTable(gauge);


More information about the Dive4elements-commits mailing list