comparison 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
comparison
equal deleted inserted replaced
8641:c851d1ea543a 8642:9db1f48bfea9
33 } 33 }
34 34
35 public static final int MIN_COLUMNS = 9; 35 public static final int MIN_COLUMNS = 9;
36 36
37 public static final int MAX_COMMENT_LENGTH = 512; 37 public static final int MAX_COMMENT_LENGTH = 512;
38
39 public static final String MEASUREMENT_TYPE_BEDLOAD = "Geschiebe";
40 public static final String MEASUREMENT_TYPE_SUSP = "Schwebstoff";
38 41
39 private static final Logger log = Logger 42 private static final Logger log = Logger
40 .getLogger(MeasurementStationsParser.class); 43 .getLogger(MeasurementStationsParser.class);
41 44
42 private List<ImportMeasurementStation> measurementStations; 45 private List<ImportMeasurementStation> measurementStations;
138 } 141 }
139 } 142 }
140 143
141 protected String getMeasurementType(String[] cols, int lineNum) 144 protected String getMeasurementType(String[] cols, int lineNum)
142 throws MeasurementStationParserException { 145 throws MeasurementStationParserException {
143 if (cols[2] == null || cols[2].length() == 0) { 146 String mtype = cols[2].trim();
147 if (!(MEASUREMENT_TYPE_BEDLOAD.equals(mtype) ||
148 MEASUREMENT_TYPE_SUSP.equals(mtype))) {
144 throw new MeasurementStationParserException( 149 throw new MeasurementStationParserException(
145 "invalid measurement type in line " + lineNum); 150 "invalid measurement type in line " + lineNum);
146 } 151 }
147 152
148 return cols[2]; 153 return mtype;
149 } 154 }
150 155
151 protected String getRiverside(String[] cols, int lineNum) { 156 protected String getRiverside(String[] cols, int lineNum) {
152 String col = cols[3]; 157 String col = cols[3];
153 if (col == null || col.length() == 0) { 158 if (col == null || col.length() == 0) {

http://dive4elements.wald.intevation.org