[PATCH 2 of 2] WST-Parser: check consistence of station ordering in file

Wald Commits scm-commit at wald.intevation.org
Tue Oct 15 19:19:55 CEST 2013


# HG changeset patch
# User Tom Gottfried <tom at intevation.de>
# Date 1381857585 -7200
# Branch double-precision
# Node ID c9b9176b053038d4872c5b7243cf207ace4c442a
# Parent  588b02a4078afddbd637bdbd1665557fa50f3126
WST-Parser: check consistence of station ordering in file.

diff -r 588b02a4078a -r c9b9176b0530 backend/src/main/java/org/dive4elements/river/importer/parsers/WstParser.java
--- a/backend/src/main/java/org/dive4elements/river/importer/parsers/WstParser.java	Tue Oct 15 19:18:44 2013 +0200
+++ b/backend/src/main/java/org/dive4elements/river/importer/parsers/WstParser.java	Tue Oct 15 19:19:45 2013 +0200
@@ -338,6 +338,15 @@
                         continue;
                     }
 
+                    // check consistence of station ordering in file
+                    if (kmHist2 != null && 
+                        kmHist2.compareTo(kmHist1) != kmHist1.compareTo(kaem)) {
+                        throw new ParseException("Stations in " + file + 
+                            " near line " + in.getLineNumber() + 
+                            " not ordered. File rejected.");
+		    }
+
+                    // remember stations in two previous lines
                     kmHist2 = kmHist1;
                     kmHist1 = kaem;
 


More information about the Dive4elements-commits mailing list