Mercurial > dive4elements > river
diff flys-backend/src/main/java/de/intevation/flys/importer/parsers/MeasurementStationsParser.java @ 5451:278d8759c92b
Allow null values in measurement_station columns without 'not null' constraints.
author | Raimund Renkert <rrenkert@intevation.de> |
---|---|
date | Wed, 27 Mar 2013 11:47:56 +0100 |
parents | f63b39799d2d |
children | de3c77d35fef |
line wrap: on
line diff
--- a/flys-backend/src/main/java/de/intevation/flys/importer/parsers/MeasurementStationsParser.java Wed Mar 27 11:46:00 2013 +0100 +++ b/flys-backend/src/main/java/de/intevation/flys/importer/parsers/MeasurementStationsParser.java Wed Mar 27 11:47:56 2013 +0100 @@ -112,16 +112,15 @@ } } - protected ImportRange getRange(String[] cols) - throws MeasurementStationParserException { + protected ImportRange getRange(String[] cols) { if (cols[4] == null || cols[4].length() == 0) { - throw new MeasurementStationParserException("invalid lower range '" - + cols[4] + "'"); + log.warn("No upper value for range found in '" + cols[4] + "'"); + return null; } if (cols[5] == null || cols[5].length() == 0) { - throw new MeasurementStationParserException("invalid lower range '" - + cols[5] + "'"); + log.warn("No upper value for range found in '" + cols[5] + "'"); + return null; } try { @@ -131,8 +130,8 @@ return new ImportRange(new BigDecimal(lower), new BigDecimal(upper)); } catch (ParseException e) { - throw new MeasurementStationParserException( - "unable to parse range: " + e.getMessage()); + log.warn("unable to parse range: " + e.getMessage()); + return null; } } @@ -150,21 +149,17 @@ return cols[3]; } - protected String getGauge(String[] cols) - throws MeasurementStationParserException { + protected String getGauge(String[] cols) { if (cols[6] == null || cols[6].length() == 0) { - throw new MeasurementStationParserException("invalid gauge '" - + cols[6] + "'"); + log.warn("invalid gauge found: '" + cols[6] + "'"); } return cols[6]; } - protected ImportTimeInterval getObservationTimerange(String[] cols) - throws MeasurementStationParserException { + protected ImportTimeInterval getObservationTimerange(String[] cols) { if (cols[8] == null || cols[8].length() == 0) { - throw new MeasurementStationParserException( - "invalid observation time '" + cols[8] + "'"); + log.warn("Found invalid observation time '" + cols[8] + "'"); } try { @@ -173,13 +168,13 @@ if (date != null) { return new ImportTimeInterval(date); } - - throw new MeasurementStationParserException( - "invalid observation time '" + cols[8] + "'"); + log.warn("Observation time date invalid: '" + cols[8] + "'"); } catch (ParseException pe) { - throw new MeasurementStationParserException(pe.getMessage()); + log.warn("Observation time date not parseable: '" + cols[8] + "'"); + return null; } + return null; } protected String getOperator(String[] cols) {