bioformats icon indicating copy to clipboard operation
bioformats copied to clipboard

NULL being returned for a Boolean object

Open scuniff opened this issue 5 months ago • 0 comments

https://github.com/ome/bioformats/blob/678fd01d88b24208188683db77f293b0ff34e11f/components/formats-bsd/src/loci/formats/tiff/TiffParser.java#L199-L220

Referring to above, there are 3 places in method checkHeader() a null is returned. This will cause a Null Pointer Exception for those callers that are returned the result to a boolean data type and not the Boolean object.

Here are 2 examples of callers expecting boolean data type and not Boolean object:

https://github.com/ome/bioformats/blob/e4ffbe89ba6cb9fd44f92fb4dfa4cc64f3918ba5/components/formats-bsd/src/loci/formats/out/PyramidOMETiffWriter.java#L129

https://github.com/ome/bioformats/blob/0a895ae7e7895e9193c02139ca51189fe5b9c106/components/formats-gpl/src/loci/formats/in/LeicaReader.java#L775

Here’s an example of code checking for NULL and taking appropriate action:

https://github.com/ome/bioformats/blob/678fd01d88b24208188683db77f293b0ff34e11f/components/formats-bsd/src/loci/formats/in/MinimalTiffReader.java#L448-L452

If it’s thought that this is an issue, my Eclipse seems to indicate there are about 10 other callers with this NPE situation.

scuniff avatar Sep 08 '24 16:09 scuniff