# HG changeset patch # User Sascha L. Teichmann # Date 1404914584 -7200 # Node ID 4ec43afaa263c05785eaea490822588d7310a4dd # Parent 139b057a39ddbcb75a11e8ca6973e87854d06de0# Parent aa8dcf7331a815fc32962a817b6285e7eac31168 Merged diff -r aa8dcf7331a8 -r 4ec43afaa263 backend/src/main/java/org/dive4elements/river/importer/parsers/HYKParser.java --- a/backend/src/main/java/org/dive4elements/river/importer/parsers/HYKParser.java Wed Jul 09 15:56:15 2014 +0200 +++ b/backend/src/main/java/org/dive4elements/river/importer/parsers/HYKParser.java Wed Jul 09 16:03:04 2014 +0200 @@ -111,6 +111,8 @@ ImportHYKEntry entry = null; ImportHYKFormation formation = null; + BigDecimal lastZoneEnd = null; + while ((line = in.readLine()) != null) { if (line.startsWith("*") || line.startsWith("----")) { @@ -186,6 +188,22 @@ "failed in line " + in.getLineNumber()); return false; } + + if (parts.length > 3) { + try { + lastZoneEnd = new BigDecimal(parts[3]); + } + catch (NumberFormatException nfe) { + log.error( + "HYK: parsing last flow zone end in " + + "failed in line " + in.getLineNumber()); + return false; + } + } + else { + lastZoneEnd = null; + } + formation = new ImportHYKFormation(); formation.setBottom(bottom); formation.setTop(top); @@ -247,7 +265,10 @@ } for (int i = 0; i < coords.length; ++i) { BigDecimal a = coords[i]; - BigDecimal b = coords[i == coords.length-1 ? i : i+1]; + BigDecimal b = i == coords.length-1 + ? (lastZoneEnd != null ? lastZoneEnd : coords[i]) + : coords[i+1]; + if (a.compareTo(b) > 0) { log.warn("HYK: zone coordinates swapped in line " + in.getLineNumber());