[Dive4elements-commits] [PATCH 2 of 3] Do not die in W80 parser id invalid date is given
Wald Commits
scm-commit at wald.intevation.org
Fri Jan 4 15:56:08 CET 2013
# HG changeset patch
# User Sascha L. Teichmann <teichmann at intevation.de>
# Date 1357310793 -3600
# Node ID 92a08725bc63da7d298a2cdf382c2545e1a518ec
# Parent 99f9e371371b9c882354938cc313542dcd8c8baf
Do not die in W80 parser id invalid date is given.
diff -r 99f9e371371b -r 92a08725bc63 flys-backend/src/main/java/de/intevation/flys/importer/parsers/W80Parser.java
--- a/flys-backend/src/main/java/de/intevation/flys/importer/parsers/W80Parser.java Fri Jan 04 15:35:51 2013 +0100
+++ b/flys-backend/src/main/java/de/intevation/flys/importer/parsers/W80Parser.java Fri Jan 04 15:46:33 2013 +0100
@@ -82,6 +82,9 @@
/** Get the year of this cross sections measurement. */
@Override
public Integer getYear() {
+ if (anchorDate == null) {
+ return Integer.valueOf(0);
+ }
Calendar dateCalendar = Calendar.getInstance();
dateCalendar.setTime(anchorDate);
return dateCalendar.get(Calendar.YEAR);
@@ -222,7 +225,12 @@
currentLine = new ArrayList<XY>();
data.put(stationKm, currentLine);
currentLine.add(new XY(0d, heightM,0));
- anchorDate = DateGuesser.guessDate(date);
+ try {
+ anchorDate = DateGuesser.guessDate(date);
+ }
+ catch (IllegalArgumentException iae) {
+ logger.warn("W80: Invalid date '" + date + "'.");
+ }
}
else {
addPoint(gkRightKm, gkHighKm, heightM, pointIndex);
More information about the Dive4elements-commits
mailing list