[mdr-users] Improved exception handling in NBMDRepositoryImpl.createExtent ?

Pieter Van Gorp <[email protected]> Thu, 27 Oct 2005 11:14:52 +0200
Newsgroups gmane.comp.java.netbeans.modules.mdr.user
Message-ID <[email protected]>
Hi, in createExtent(String substName, RefObject metaPackage,
RefPackage[] existingInstances, String storageId) there is the
following code:
<snip source="http://www.netbeans.org/source/browse/mdr/src/org/netbeans/mdr/NBMDRepositoryImpl.java?rev=1.84&content-type=text/vnd.viewcvs-markup">
       try {
                instantiatePackage(substName, null, (MofPackage)
metaPackage, instancesToCluster, storageId, false);
            } catch (RuntimeException e) {
                throw (CreationFailedException)
Logger.getDefault().annotate(new CreationFailedException("Cannot
instantiate package because of unexpected exception: " + e), e);
            }
</snip>

Could this be improved by passing the exception e to the constructor
of CreationFailedException?  Right now, one has to use a debugger to
find out at what line the actual e (which is a NPE in my case) occurs
whereas otherwise the stacktrace would contain all necessary info...

Best regards,
--
Pieter Van Gorp
       Teaching and Research Assistant
       FOrmal Techniques in Software engineering (FOTS)
       University of Antwerp
       Middelheimlaan 1
       2020 Antwerpen - Belgium
       Office: G.304
       Phone: +32 3 265 38 71
       Fax: +32 3 265 37 77
       http://www.fots.ua.ac.be/~pvgorp/research/
       http://motmot.sourceforge.net/