[Dive4elements-commits] [PATCH] Allow empty years in bed height parser

Wald Commits scm-commit at wald.intevation.org
Fri Mar 15 19:35:50 CET 2013


# HG changeset patch
# User Sascha L. Teichmann <teichmann at intevation.de>
# Date 1363372546 -3600
# Node ID 5376aa576604fe15e3e2f94322ff676a78d298db
# Parent  555835611acd896dc2dff3a5f588814c3d330459
Allow empty years in bed height parser.

diff -r 555835611acd -r 5376aa576604 flys-backend/src/main/java/de/intevation/flys/importer/ImportBedHeightSingle.java
--- 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;
diff -r 555835611acd -r 5376aa576604 flys-backend/src/main/java/de/intevation/flys/importer/parsers/BedHeightParser.java
--- 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;


More information about the Dive4elements-commits mailing list