[Insight-developers] exception swallowed by ImageFileReader::GenerateOutputInformation()

Steve M. Robbins steve at sumost.ca
Tue Jul 10 01:30:52 EDT 2007


Hi Luis,

On Mon, Jul 09, 2007 at 07:14:44PM -0400, Luis Ibanez wrote:

> Note however that in this case, the exception is not
> simply "swallowed". Instead, the actual message is
> carried along to line: 125, and then used to compose
> a more detailed exception message in lines 131-141.
>
>
> The exception is finally rethrown in lines 143-144
> as a more specific type of Exception:
>
>           "ImageFileReaderException"

Yes, but only if ( m_ImageIO.IsNull() ), tested in line 120.

m_ImageIO is certainly not null if the user has set it via
SetImageIO().  

Even if the user has not set it, there's no documentation that leads
one to believe that ImageIOFactory::CreateImageIO( filename, ...)
returns null if filename doesn't exist.  The implementation
effectively calls ImageIO::CanReadFile() on all candidates and there's
no documentation that suggests you can't simply implement
CanReadFile() as "filename ends in .jpg" --- not that I actually found
any such implementation.


> Please let us know if you find any other suspicious code.

I forgot to mention this earlier, but ImageFileReader::GenerateData()
has the same try/catch block.  In this case, however, the exception
*is* well and truly swallowed: the carefully saved m_ExceptionMessage
is never used.

Cheers,
-Steve

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://www.itk.org/mailman/private/insight-developers/attachments/20070710/ac7a31b6/attachment.pgp


More information about the Insight-developers mailing list