[PATCH] Correct r7481: use ParseException instead of IllegalArgument that was catched at wrong place
Wald Commits
scm-commit at wald.intevation.org
Thu Oct 31 19:16:46 CET 2013
# HG changeset patch
# User Tom Gottfried <tom at intevation.de>
# Date 1383243402 -3600
# Node ID e327492ba9d00f0ce72bcfa19c8d133fd34e2a48
# Parent 6b278187ed9d8c034086c0ac9ab77ef51c34ea45
Correct r7481: use ParseException instead of IllegalArgument that was catched at wrong place.
diff -r 6b278187ed9d -r e327492ba9d0 backend/src/main/java/org/dive4elements/river/importer/parsers/WstParser.java
--- 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,
More information about the Dive4elements-commits
mailing list