Skip to content

Commit

Permalink
Prevent NumberFormatExceptions when metadata is missing
Browse files Browse the repository at this point in the history
See #8445.
  • Loading branch information
melissalinkert committed Apr 5, 2012
1 parent 8610163 commit 5cc196d
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions components/bio-formats/src/loci/formats/in/IvisionReader.java
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}
}
}
}
Expand Down

0 comments on commit 5cc196d

Please sign in to comment.