[vtkusers] Catching VTK exceptions in Java

Jeff Lee jeff at cdnorthamerica.com
Fri Dec 5 12:49:26 EST 2003


On second thought, mabey it isn't a good thing to have in vtk itself, 
but is more appropriate in your application code.  I was just thinking 
of some obscure compiler that vtk supports which doesn't support 
exception-handling.  Mabey that is the reason why things like this don't 
already exist in vtk.
-Jeff

Jeff Lee wrote:

>
>
> 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
>>
>>
>>  
>>
>
>
> _______________________________________________
> This is the private VTK discussion list. Please keep messages 
> on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>




More information about the vtkusers mailing list