changeset 357:e0bbb54f2f7c

Added reset for errors and warnings in importer.
author Raimund Renkert <rrenkert@intevation.de>
date Thu, 05 Sep 2013 13:15:59 +0200
parents 3f03e954c04d
children 7b1b0b545741
files src/main/java/de/intevation/lada/data/importer/Importer.java src/main/java/de/intevation/lada/data/importer/LAFImporter.java src/main/java/de/intevation/lada/rest/LAFImportService.java
diffstat 3 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/de/intevation/lada/data/importer/Importer.java	Thu Sep 05 13:14:39 2013 +0200
+++ b/src/main/java/de/intevation/lada/data/importer/Importer.java	Thu Sep 05 13:15:59 2013 +0200
@@ -11,4 +11,5 @@
     public boolean importData(String content, AuthenticationResponse auth);
     public Map<String, List<ReportData>> getErrors();
     public Map<String, List<ReportData>> getWarnings();
+    public void reset();
 }
--- a/src/main/java/de/intevation/lada/data/importer/LAFImporter.java	Thu Sep 05 13:14:39 2013 +0200
+++ b/src/main/java/de/intevation/lada/data/importer/LAFImporter.java	Thu Sep 05 13:15:59 2013 +0200
@@ -121,4 +121,10 @@
         this.errors.putAll(this.parser.getErrors());
         return true;
     }
+
+    public void reset() {
+        parser.reset();
+        this.warnings = new HashMap<String, List<ReportData>>();
+        this.errors = new HashMap<String, List<ReportData>>();
+    }
 }
--- a/src/main/java/de/intevation/lada/rest/LAFImportService.java	Thu Sep 05 13:14:39 2013 +0200
+++ b/src/main/java/de/intevation/lada/rest/LAFImportService.java	Thu Sep 05 13:15:59 2013 +0200
@@ -84,6 +84,7 @@
                 }
             }
             catch (IOException e) {
+                importer.reset();
                 return new Response(false, 603, null);
             }
 
@@ -97,9 +98,11 @@
                 code = 670;
             }
             Response response = new Response(success, code, respData);
+            importer.reset();
             return response;
         }
         catch(AuthenticationException ae) {
+            importer.reset();
             return new Response(false, 699, null);
         }
     }
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)