[vtkusers] Catching VTK exceptions in Java

Jeff Lee jeff at cdnorthamerica.com
Fri Dec 5 12:35:33 EST 2003


Mark Hünken wrote:

>I haven't tried it myself (yet), but shouldn't it be possible to catch
>bad_allocs by setting up your own exception handler?
>
>Something like
>_set_new_handler(MyBadAllocHandler)
>
>int MyBadAllocHandler(size_t size)
>{
>    throw the appropriate java exception
>    and prevent VTK from running into memory access violations
>}
>
>  
>
Absolutely right, forgot that there are the 4 standard exeptions, 
bad_alloc, bad_cast, bad_typeid, bad_exception.  We could do something 
like this in vtkJavaAwt.h or vtkJavaUtils and propogate them up to 
java.  The only ones that make any sense to implement would be bad_alloc 
and bad_exception.  Any comments?  Seems like a good thing to have.  I 
could take a stab at it sometime and post back when its ready,
-Jeff

>Just an idea, but I would be interesting in any comments anyway.
>
>Cheers,
>Mark
>
>
>  
>





More information about the vtkusers mailing list