changeset 7487:e327492ba9d0

Correct r7481: use ParseException instead of IllegalArgument that was catched at wrong place.
author Tom Gottfried <tom@intevation.de>
date Thu, 31 Oct 2013 19:16:42 +0100
parents 6b278187ed9d
children 1890bd524d27
files backend/src/main/java/org/dive4elements/river/importer/parsers/WstParser.java
diffstat 1 files changed, 5 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/backend/src/main/java/org/dive4elements/river/importer/parsers/WstParser.java	Thu Oct 31 19:03:57 2013 +0100
+++ b/backend/src/main/java/org/dive4elements/river/importer/parsers/WstParser.java	Thu Oct 31 19:16:42 2013 +0100
@@ -189,13 +189,7 @@
                 // handle Q-lines
                 if (line.startsWith("*\u001f")) {
                     BigDecimal [] data = null;
-                    try {
-                        data = parseLineAsDouble(line, columnCount, false, true);
-                    }
-                    catch(IllegalArgumentException iae) {
-                        log.error(iae.getMessage());
-                        return;
-                    }
+                    data = parseLineAsDouble(line, columnCount, false, true);
 
                     if (aktAbfluesse != null) { // add Q-ranges obtained from previous lines
                         if (kmHist1 != null && kmHist2 != null
@@ -336,13 +330,7 @@
                     }
 
                     BigDecimal [] data = null;
-                    try {
-                        data = parseLineAsDouble(line, columnCount, true, false);
-                    }
-                    catch(IllegalArgumentException iae) {
-                        log.error(iae.getMessage());
-                        return;
-                    }
+                    data = parseLineAsDouble(line, columnCount, true, false);
 
                     BigDecimal kaem = data[0];
 
@@ -509,7 +497,7 @@
         int     count,
         boolean bStation,
         boolean bParseEmptyAsZero
-    ) {
+    ) throws ParseException {
         String [] tokens = parseLine(line, count, bStation);
 
         BigDecimal [] doubles = new BigDecimal[tokens.length];
@@ -531,7 +519,7 @@
         String  line,
         int     tokenCount,
         boolean bParseStation
-    ) {
+    ) throws ParseException {
         ArrayList<String> strings = new ArrayList<String>();
 
         if (bParseStation) {
@@ -545,7 +533,7 @@
         for (int i = 0; i < tokenCount; ++i) {
             pos += 9;
             if (pos >= line.length()) {
-                throw new IllegalArgumentException(
+                throw new ParseException(
                     "WST: number of columns is less than expected. File rejected.");
             }
             strings.add(line.substring(pos, 

http://dive4elements.wald.intevation.org