Mercurial > dive4elements > river
comparison flys-backend/src/main/java/de/intevation/flys/importer/parsers/W80Parser.java @ 4769:92a08725bc63
Do not die in W80 parser id invalid date is given.
author | Sascha L. Teichmann <teichmann@intevation.de> |
---|---|
date | Fri, 04 Jan 2013 15:46:33 +0100 |
parents | 99f9e371371b |
children | 34398f424cfd |
comparison
equal
deleted
inserted
replaced
4768:99f9e371371b | 4769:92a08725bc63 |
---|---|
80 | 80 |
81 | 81 |
82 /** Get the year of this cross sections measurement. */ | 82 /** Get the year of this cross sections measurement. */ |
83 @Override | 83 @Override |
84 public Integer getYear() { | 84 public Integer getYear() { |
85 if (anchorDate == null) { | |
86 return Integer.valueOf(0); | |
87 } | |
85 Calendar dateCalendar = Calendar.getInstance(); | 88 Calendar dateCalendar = Calendar.getInstance(); |
86 dateCalendar.setTime(anchorDate); | 89 dateCalendar.setTime(anchorDate); |
87 return dateCalendar.get(Calendar.YEAR); | 90 return dateCalendar.get(Calendar.YEAR); |
88 } | 91 } |
89 | 92 |
220 if (anchor == null || !anchor.sameStation(stationKm)) { | 223 if (anchor == null || !anchor.sameStation(stationKm)) { |
221 anchor = new Anchor(gkRightKm, gkHighKm, heightM, stationKm); | 224 anchor = new Anchor(gkRightKm, gkHighKm, heightM, stationKm); |
222 currentLine = new ArrayList<XY>(); | 225 currentLine = new ArrayList<XY>(); |
223 data.put(stationKm, currentLine); | 226 data.put(stationKm, currentLine); |
224 currentLine.add(new XY(0d, heightM,0)); | 227 currentLine.add(new XY(0d, heightM,0)); |
225 anchorDate = DateGuesser.guessDate(date); | 228 try { |
229 anchorDate = DateGuesser.guessDate(date); | |
230 } | |
231 catch (IllegalArgumentException iae) { | |
232 logger.warn("W80: Invalid date '" + date + "'."); | |
233 } | |
226 } | 234 } |
227 else { | 235 else { |
228 addPoint(gkRightKm, gkHighKm, heightM, pointIndex); | 236 addPoint(gkRightKm, gkHighKm, heightM, pointIndex); |
229 } | 237 } |
230 } | 238 } |