[Lada-commits] [PATCH] Fix identification of identifier for error report

Wald Commits scm-commit at wald.intevation.org
Wed Oct 26 20:34:49 CEST 2016


# HG changeset patch
# User Tom Gottfried <tom at intevation.de>
# Date 1477505891 -7200
# Node ID 2c198f13270ba5bf3efb9a86a7f77be509c23156
# Parent  7ea01e09dff4cca4b431fb3c0f2be4087fa398bd
Fix identification of identifier for error report.

Setting it to null if the previous attempt was successfull already
obviously was a flaw. Using the wrong key HAUPTPROBEN_NR probably
could have been avoided by usage of appropriate constants.

diff -r 7ea01e09dff4 -r 2c198f13270b src/main/java/de/intevation/lada/importer/laf/LafObjectListener.java
--- a/src/main/java/de/intevation/lada/importer/laf/LafObjectListener.java	Wed Oct 26 18:54:48 2016 +0200
+++ b/src/main/java/de/intevation/lada/importer/laf/LafObjectListener.java	Wed Oct 26 20:18:11 2016 +0200
@@ -86,9 +86,17 @@
         if (currentProbe != null) {
             data.addProbe(currentProbe);
             if (!currentErrors.isEmpty()) {
-                String identifier = currentProbe.getAttributes().get("PROBE_ID");
-                identifier = identifier == null ? currentProbe.getAttributes().get("PROBEN_NR") : null;
-                identifier = identifier == null ? currentProbe.getAttributes().get("HAUPTPROBEN_NR") : "not identified";
+                String identifier = currentProbe.getAttributes()
+                    .get("PROBE_ID");
+                identifier = identifier == null
+                    ? currentProbe.getAttributes().get("PROBEN_NR")
+                    : identifier;
+                identifier = identifier == null
+                    ? currentProbe.getAttributes().get("HAUPTPROBENNUMMER")
+                    : identifier;
+                identifier = identifier == null
+                    ? "not identified"
+                    : identifier;
                 System.out.println("exit: " + identifier);
                 errors.put(identifier, currentErrors);
             }
@@ -126,8 +134,12 @@
                 System.out.println("item: " + item.getKey());
             }
             String identifier = currentProbe.getAttributes().get("PROBE_ID");
-            identifier = identifier == null ? currentProbe.getAttributes().get("PROBEN_NR") : null;
-            identifier = identifier == null ? currentProbe.getAttributes().get("HAUPTPROBEN_NR") : null;
+            identifier = identifier == null
+                ? currentProbe.getAttributes().get("PROBEN_NR")
+                : identifier;
+            identifier = identifier == null
+                ? currentProbe.getAttributes().get("HAUPTPROBENNUMMER")
+                : identifier;
             identifier = identifier == null ? "not identified" : identifier;
             System.out.println("exit probe: " + identifier);
             errors.put(identifier, currentErrors);


More information about the Lada-commits mailing list