[vtkusers] Catching VTK exceptions in Java

Steve Joyce Steve.Joyce at sercoassurance.com
Mon Dec 8 04:10:01 EST 2003


Jeff and Mark,

Thanks for the suggestions.
My application code is in Java, but I presume I would have to set up
the exception handlers in C++ and access them using JNI. Is that
correct?

Thanks,
Steve


>>> Jeff Lee <jeff at cdnorthamerica.com> 05/12/2003 17:49:26 >>>
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 
>
>





****Disclaimer***********
This e-mail and any attachments may contain confidential and/or privileged material; it  is for the intended addressee(s) only.  If you are not a named addressee, you must not use, retain or disclose such information.
 
Serco cannot guarantee that the e-mail or any attachments are free from viruses.
 
The views expressed in this e-mail are those of the originator and do not necessarily represent the views of Serco.
 
Nothing in this e-mail shall bind Serco in any contract or obligation.
 
Serco Group plc.  Registered in England and Wales.  No: 2048608
Registered Office:  Serco House, 16 Bartley Wood Business Park, Bartley Way, Hook, Hampshire, RG27 9UY, United Kingdom.
****End Disclaimer*******
<<<<GWIASIG 0.07>>>>



More information about the vtkusers mailing list