changeset 1134:c1713b7fbfa0

Use any identifier because idAlt might be null. In case null was used as a key, a serialization error occured.
author Tom Gottfried <tom@intevation.de>
date Tue, 01 Nov 2016 14:20:30 +0100
parents b2c3a59b40f8
children 39a12fa9421d
files src/main/java/de/intevation/lada/importer/laf/LafObjectMapper.java
diffstat 1 files changed, 17 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/de/intevation/lada/importer/laf/LafObjectMapper.java	Tue Nov 01 14:19:11 2016 +0100
+++ b/src/main/java/de/intevation/lada/importer/laf/LafObjectMapper.java	Tue Nov 01 14:20:30 2016 +0100
@@ -125,13 +125,12 @@
             err.setKey(userInfo.getName());
             err.setValue("Messstelle " + probe.getMstId());
             currentErrors.add(err);
-            if (currentErrors.size() > 0) {
-                List<ReportItem> copyErr = new ArrayList<ReportItem>(currentErrors);
-                errors.put(probe.getIdAlt(), copyErr);
-            }
+            errors.put(object.getIdentifier(),
+                new ArrayList<ReportItem>(currentErrors));
+
             if (currentWarnings.size() > 0) {
-                List<ReportItem> copyWarn = new ArrayList<ReportItem>(currentWarnings);
-                warnings.put(probe.getIdAlt(), copyWarn);
+                warnings.put(object.getIdentifier(),
+                    new ArrayList<ReportItem>(currentWarnings));
             }
             return;
         }
@@ -162,12 +161,12 @@
                 err.setValue("");
                 currentErrors.add(err);
                 if (currentErrors.size() > 0) {
-                    List<ReportItem> copyErr = new ArrayList<ReportItem>(currentErrors);
-                    errors.put(probe.getIdAlt(), copyErr);
+                    errors.put(object.getIdentifier(),
+                        new ArrayList<ReportItem>(currentErrors));
                 }
                 if (currentWarnings.size() > 0) {
-                    List<ReportItem> copyWarn = new ArrayList<ReportItem>(currentWarnings);
-                    warnings.put(probe.getIdAlt(), copyWarn);
+                    warnings.put(object.getIdentifier(),
+                        new ArrayList<ReportItem>(currentWarnings));
                 }
                 return;
             }
@@ -196,12 +195,12 @@
             err.setValue("No valid Probe Object");
             currentErrors.add(err);
             if (currentErrors.size() > 0) {
-                List<ReportItem> copyErr = new ArrayList<ReportItem>(currentErrors);
-                errors.put(probe.getIdAlt(), copyErr);
+                errors.put(object.getIdentifier(),
+                    new ArrayList<ReportItem>(currentErrors));
             }
             if (currentWarnings.size() > 0) {
-                List<ReportItem> copyWarn = new ArrayList<ReportItem>(currentWarnings);
-                warnings.put(probe.getIdAlt(), copyWarn);
+                warnings.put(object.getIdentifier(),
+                    new ArrayList<ReportItem>(currentWarnings));
             }
             return;
         }
@@ -237,12 +236,12 @@
         }
 
         if (currentErrors.size() > 0) {
-            List<ReportItem> copyErr = new ArrayList<ReportItem>(currentErrors);
-            errors.put(probe.getIdAlt(), copyErr);
+            errors.put(object.getIdentifier(),
+                new ArrayList<ReportItem>(currentErrors));
         }
         if (currentWarnings.size() > 0) {
-            List<ReportItem> copyWarn = new ArrayList<ReportItem>(currentWarnings);
-            warnings.put(probe.getIdAlt(), copyWarn);
+            warnings.put(object.getIdentifier(),
+                new ArrayList<ReportItem>(currentWarnings));
         }
     }
 
@@ -265,7 +264,6 @@
             return;
         }
 
-
         // Compare with messung objects in the db
         Messung newMessung = null;
         try {
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)