changeset 1107:2c198f13270b

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.
author Tom Gottfried <tom@intevation.de>
date Wed, 26 Oct 2016 20:18:11 +0200
parents 7ea01e09dff4
children 5bc1260b55f1
files src/main/java/de/intevation/lada/importer/laf/LafObjectListener.java
diffstat 1 files changed, 17 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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);
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)