Mercurial > dive4elements > river
diff backend/src/main/java/org/dive4elements/river/importer/parsers/MeasurementStationsParser.java @ 8642:9db1f48bfea9
Enforce strings we rely on.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Fri, 27 Mar 2015 18:54:03 +0100 |
parents | 17db08570637 |
children | 8fbc0649da13 |
line wrap: on
line diff
--- a/backend/src/main/java/org/dive4elements/river/importer/parsers/MeasurementStationsParser.java Fri Mar 27 17:42:27 2015 +0100 +++ b/backend/src/main/java/org/dive4elements/river/importer/parsers/MeasurementStationsParser.java Fri Mar 27 18:54:03 2015 +0100 @@ -36,6 +36,9 @@ public static final int MAX_COMMENT_LENGTH = 512; + public static final String MEASUREMENT_TYPE_BEDLOAD = "Geschiebe"; + public static final String MEASUREMENT_TYPE_SUSP = "Schwebstoff"; + private static final Logger log = Logger .getLogger(MeasurementStationsParser.class); @@ -140,12 +143,14 @@ protected String getMeasurementType(String[] cols, int lineNum) throws MeasurementStationParserException { - if (cols[2] == null || cols[2].length() == 0) { + String mtype = cols[2].trim(); + if (!(MEASUREMENT_TYPE_BEDLOAD.equals(mtype) || + MEASUREMENT_TYPE_SUSP.equals(mtype))) { throw new MeasurementStationParserException( "invalid measurement type in line " + lineNum); } - return cols[2]; + return mtype; } protected String getRiverside(String[] cols, int lineNum) {