[Lada-commits] [PATCH 5 of 5] Use any identifier because idAlt might be null

Wald Commits scm-commit at wald.intevation.org
Tue Nov 1 14:21:14 CET 2016


# HG changeset patch
# User Tom Gottfried <tom at intevation.de>
# Date 1478006430 -3600
# Node ID c1713b7fbfa01f042ba8ce7612c7b14705b13d79
# Parent  b2c3a59b40f8f9f748c4bb0cb7566b6a3e48a32e
Use any identifier because idAlt might be null.

In case null was used as a key, a serialization error occured.

diff -r b2c3a59b40f8 -r c1713b7fbfa0 src/main/java/de/intevation/lada/importer/laf/LafObjectMapper.java
--- 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 {


More information about the Lada-commits mailing list