Mercurial > dive4elements > river
comparison backend/src/main/java/org/dive4elements/river/importer/parsers/W80CSVParser.java @ 5922:8ed9b1edace6
issue1267: W80CSVParser do not stumble about malformed lines.
author | Felix Wolfsteller <felix.wolfsteller@intevation.de> |
---|---|
date | Wed, 08 May 2013 11:42:08 +0200 |
parents | 4dd33b86dc61 |
children | 4c3ccf2b0304 |
comparison
equal
deleted
inserted
replaced
5921:17b07104d093 | 5922:8ed9b1edace6 |
---|---|
248 String date = fields[10]; | 248 String date = fields[10]; |
249 String height = fields[18]; | 249 String height = fields[18]; |
250 String dateH = line.substring(54,60); | 250 String dateH = line.substring(54,60); |
251 String dateDec = line.substring(64,70); | 251 String dateDec = line.substring(64,70); |
252 | 252 |
253 double stationKm = Double.parseDouble(station) / 1000d; | 253 double stationKm; |
254 double gkRightKm = Double.parseDouble(gkRight.replace(",","."));//.substring(0,7)); | 254 double gkRightKm; |
255 double gkHighKm = Double.parseDouble(gkHigh.replace(",","."));//.substring(0,7)); | 255 double gkHighKm; |
256 double heightM = Double.parseDouble(height.replace(",",".")); | 256 double heightM; |
257 | |
258 try { | |
259 stationKm = Double.parseDouble(station) / 1000d; | |
260 gkRightKm = Double.parseDouble(gkRight.replace(",","."));//.substring(0,7)); | |
261 gkHighKm = Double.parseDouble(gkHigh.replace(",","."));//.substring(0,7)); | |
262 heightM = Double.parseDouble(height.replace(",",".")); | |
263 } | |
264 catch (java.lang.NumberFormatException nfe) { | |
265 logger.error("Skipping malformed w80csv line #" + lineNum); | |
266 return; | |
267 } | |
257 | 268 |
258 // New (or first) line. | 269 // New (or first) line. |
259 if (anchor == null || !anchor.sameStation(stationKm)) { | 270 if (anchor == null || !anchor.sameStation(stationKm)) { |
260 anchor = new Anchor(gkRightKm, gkHighKm, heightM, stationKm); | 271 anchor = new Anchor(gkRightKm, gkHighKm, heightM, stationKm); |
261 lastPointGK[0] = gkRightKm; | 272 lastPointGK[0] = gkRightKm; |