From 5cc196dd44a458b1292ac0e09b3515c7fe6c4479 Mon Sep 17 00:00:00 2001 From: Melissa Linkert Date: Thu, 5 Apr 2012 15:20:30 -0400 Subject: [PATCH] Prevent NumberFormatExceptions when metadata is missing See #8445. --- .../src/loci/formats/in/IvisionReader.java | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/components/bio-formats/src/loci/formats/in/IvisionReader.java b/components/bio-formats/src/loci/formats/in/IvisionReader.java index 7bfdbb336af..ac7e07bd591 100644 --- a/components/bio-formats/src/loci/formats/in/IvisionReader.java +++ b/components/bio-formats/src/loci/formats/in/IvisionReader.java @@ -275,7 +275,14 @@ protected void initFile(String id) throws FormatException, IOException { store.setImageInstrumentRef(instrumentID, 0); if (deltaT != null) { - store.setPixelsTimeIncrement(new Double(deltaT), 0); + Double increment = 0d; + try { + increment = new Double(deltaT); + } + catch (NumberFormatException e) { + LOGGER.debug("Failed to parse time increment", e); + } + store.setPixelsTimeIncrement(increment, 0); } String objectiveID = MetadataTools.createLSID("Objective", 0, 0); @@ -306,7 +313,12 @@ protected void initFile(String id) throws FormatException, IOException { store.setDetectorSettingsBinning(getBinning(binX + "x" + binY), 0, 0); if (gain != null) { - store.setDetectorSettingsGain(new Double(gain), 0, 0); + try { + store.setDetectorSettingsGain(new Double(gain), 0, 0); + } + catch (NumberFormatException e) { + LOGGER.debug("Failed to parse detector gain", e); + } } } }