openmicroscopy/bioformats — pull request #700 by melissalinkert (2013-09-14 16:39:23+00:00)
Title: ND2Handler: parse numbers defensively

Several numerical parsing methods throw NumberFormatException when
the input string is not actually a number. In particular:

* Integer.parseInt(String)
* Double.parseDouble(String)
* new Integer(String)
* new Double(String)

The ND2 handler parses a large number of string key/value pairs,
converting values into numbers in many cases. But in almost every case,
no error handling was done in case the input value was not a number.

This change adds a blanket try/catch for NumberFormatException around
areas that parse lots of numbers, emitting a warning for any
non-conforming key/value pairs. This allows parsing to continue,
hopefully resulting in a less fragile ND2 reader.

It also catches NumberFormatException separately within the nested
TextInfoItem parse loop, so that parsing of TextInfoItem entries fail
individually rather than all-or-nothing.

Note that this change is nearly all whitespace indentation; the easiest
way to view the "real" change is using "git show -b" on the commit.

Conflicts:

components/bio-formats/src/loci/formats/in/ND2Handler.java

See gh-691. There were many conflicts when rebasing this, so please check the diff carefully when reviewing.