[ITK-dev] Coverity 'Uncaught Exception' errors

Williams, Norman K norman-k-williams at uiowa.edu
Tue Sep 16 10:46:05 EDT 2014


Hans asked me to look at a couple of ITK Coverity defects, as they were in code written in our lab.

A couple of them are understandable but problematic.  Basically there’s an exception thrown at itkObjectFactoryBase.cxx at line 533:

531   if ( ObjectFactoryBase::m_StrictVersionChecking )
532      {
    1. exception_thrown: An exception of type "itk::ExceptionObject" is thrown.
533      itkGenericExceptionMacro(<< "Incompatible factory version load attempt:"
534                            << "\nRunning itk version :\n" << Version::GetITKSourceVersion()
535                            << "\nAttempted loading factory version:\n" << factory->GetITKSourceVersion()
536                            << "\nAttempted factory:\n" << factory->m_LibraryPath << "\n");
537      }
538    else
539      {
540      itkGenericOutputMacro(<< "Possible incompatible factory load:"
541                            << "\nRunning itk version :\n" << Version::GetITKSourceVersion()
542                            << "\nLoaded factory version:\n" << factory->GetITKSourceVersion()
543                            << "\nLoading factory:\n" << factory->m_LibraryPath << "\n");
544      }
545    }

There are 4 Coverity defects reported that all point to this code.  Given where the exceptions are thrown, it looks like every call to itk::<className>::New() should be bracketed by a try/catch pair.

But in fact Coverity only reports 4 instances of this being a problem.

I can fix the reported defects for completeness’ sake, but I find it mysterious that more defects caused by this occur.


________________________________
Notice: This UI Health Care e-mail (including attachments) is covered by the Electronic Communications Privacy Act, 18 U.S.C. 2510-2521, is confidential and may be legally privileged.  If you are not the intended recipient, you are hereby notified that any retention, dissemination, distribution, or copying of this communication is strictly prohibited.  Please reply to the sender that you have received the message in error, then delete it.  Thank you.
________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/insight-developers/attachments/20140916/876b71fc/attachment.html>


More information about the Insight-developers mailing list