changeset 5327:5376aa576604

Allow empty years in bed height parser.
author Sascha L. Teichmann <teichmann@intevation.de>
date Fri, 15 Mar 2013 19:35:46 +0100
parents 555835611acd
children 91070b784212
files flys-backend/src/main/java/de/intevation/flys/importer/ImportBedHeightSingle.java flys-backend/src/main/java/de/intevation/flys/importer/parsers/BedHeightParser.java
diffstat 2 files changed, 6 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/flys-backend/src/main/java/de/intevation/flys/importer/ImportBedHeightSingle.java	Fri Mar 15 19:28:48 2013 +0100
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/ImportBedHeightSingle.java	Fri Mar 15 19:35:46 2013 +0100
@@ -22,7 +22,7 @@
 {
     private static Logger log = Logger.getLogger(ImportBedHeightSingle.class);
 
-    protected int year;
+    protected Integer year;
     protected int soundingWidth;
 
     protected String evaluationBy;
--- a/flys-backend/src/main/java/de/intevation/flys/importer/parsers/BedHeightParser.java	Fri Mar 15 19:28:48 2013 +0100
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/parsers/BedHeightParser.java	Fri Mar 15 19:35:46 2013 +0100
@@ -203,14 +203,13 @@
 
         if (m.matches()) {
             String tmp = m.group(1);
-
-            try {
-                obj.setYear(Integer.valueOf(tmp));
-                return true;
+            if (tmp.length() > 0) {
+                obj.setYear(Integer.parseInt(tmp));
             }
-            catch (NumberFormatException e) {
-                log.warn("BHP: Error while parsing year!", e);
+            else {
+                log.warn("BHP: No year given.");
             }
+            return true;
         }
 
         return false;

http://dive4elements.wald.intevation.org