Mercurial > dive4elements > river
comparison backend/src/main/java/org/dive4elements/river/importer/parsers/BedHeightParser.java @ 8688:e1186c5ab169
(issue1763) Empty strings are most likely intended as missing values, so don't try to parse them (plus enhanced logging).
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Wed, 15 Apr 2015 18:36:11 +0200 |
parents | 1f878c82262f |
children | ea676691e533 |
comparison
equal
deleted
inserted
replaced
8687:3912da70736b | 8688:e1186c5ab169 |
---|---|
407 e.getMessage()); | 407 e.getMessage()); |
408 return; | 408 return; |
409 } | 409 } |
410 | 410 |
411 Double height = null; | 411 Double height = null; |
412 try { | 412 if (values[1].length() > 0) { |
413 height = new Double(nf.parse(values[1]).doubleValue()); | 413 try { |
414 } | 414 height = new Double(nf.parse(values[1]).doubleValue()); |
415 catch (ParseException e) { | 415 } |
416 log.warn("BSP: unparseable height " + values[1]); | 416 catch (ParseException e) { |
417 log.warn("BSP: unparseable height '" + values[1] + "'"); | |
418 } | |
417 } | 419 } |
418 | 420 |
419 Double uncertainty = null; | 421 Double uncertainty = null; |
420 if (values.length > 2) { | 422 if (values.length > 2 && values[2].length() > 0) { |
421 try { | 423 try { |
422 uncertainty = new Double(nf.parse(values[2]).doubleValue()); | 424 uncertainty = new Double(nf.parse(values[2]).doubleValue()); |
423 } | 425 } |
424 catch (ParseException e) { | 426 catch (ParseException e) { |
425 log.warn("BSP: unparseable uncertainty value " + values[2]); | 427 log.warn("BSP: unparseable uncertainty value '" |
428 + values[2] + "'"); | |
426 } | 429 } |
427 } | 430 } |
428 | 431 |
429 Double dataGap = null; | 432 Double dataGap = null; |
430 if (values.length > 3) { | 433 if (values.length > 3 && values[3].length() > 0) { |
431 try { | 434 try { |
432 dataGap = new Double(nf.parse(values[3]).doubleValue()); | 435 dataGap = new Double(nf.parse(values[3]).doubleValue()); |
433 } | 436 } |
434 catch (ParseException e) { | 437 catch (ParseException e) { |
435 log.warn("BSP: unparseable data gap " + values[3]); | 438 log.warn("BSP: unparseable data gap '" + values[3] + "'"); |
436 } | 439 } |
437 } | 440 } |
438 | 441 |
439 Double soundingWidth = null; | 442 Double soundingWidth = null; |
440 if (values.length > 4) { | 443 if (values.length > 4 && values[4].length() > 0) { |
441 try { | 444 try { |
442 soundingWidth = new Double(nf.parse(values[4]).doubleValue()); | 445 soundingWidth = new Double(nf.parse(values[4]).doubleValue()); |
443 } | 446 } |
444 catch (ParseException e) { | 447 catch (ParseException e) { |
445 log.warn("BSP: unparseable sounding width " + values[4]); | 448 log.warn("BSP: unparseable sounding width '" + |
449 values[4] + "'"); | |
446 } | 450 } |
447 } | 451 } |
448 | 452 |
449 ImportBedHeightValue value = new ImportBedHeightValue( | 453 ImportBedHeightValue value = new ImportBedHeightValue( |
450 (ImportBedHeight) obj, | 454 (ImportBedHeight) obj, |