Re: ORBit2 and checking CORBA_Environent's



Martin Baulig <martin home-of-linux org> writes:

> Owen Taylor <otaylor redhat com> writes:
> 
> > Well, except for the semi-random and hard-to-find bits, I think
> > causing crashes in this circumstance is good. Perhaps we should always
> > return, say, (CORBA_Object)0xbad in this case to get something that
> > is:
> >  
> >  - reliably non-null
> >  - In the first page, so segfaulting as fast as possible 
> > 
> > I don't think we should be encouraging people to write code that
> > is invalid according to the CORBA spec.
> 
> Well, this isn't such a bad idea, but there's still a bug.
> 
> I'm not sure about this, but am I allowed to return an invalid pointer
> from the implementation of a CORBA method if I raise an exception ?
> 
> ====
> CORBA_Object
> impl_Foo (PortableServer_Servant servant, CORBA_Environment *ev)
> {
>         bonobo_exception_set (ev, ex_something);
> 
>         return 0xbad;
> }
> ====
> 
> This currently crashes.

My understanding (from memory) is that the return value should
be completely ignored by the skeleton if an exception is thrown. 
Certainly a CORBA method that throws an object is not allowed
to return a value as well ... this would be completely
incompatible with all languages with real exceptions.

(Also, there is no marshalling of return values over the
wire when an exception is thrown.)

In the above suggestion, I was really suggesting that the stub should
return 0xbad, if an exception is thrown, not the individual server
side functions.
 
 > The problem is that AFAIK the following is allowed according to the spec:
> 
> =====
> CORBA_Object
> impl_Foo (PortableServer_Servant servant, CORBA_Environment *ev)
> {
>         return bonobo_get_object ("something", "something", ev);
> }
> ====

Well, this should be fine -- if bonobo_get_object() throws
an exception, then it won't return a newly referenced object.

Regards,
                                        Owen




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]