On 10/12/13 04:48 PM, andr...@eed.usv.ro wrote:
> Hi Karel
> Thank you kindly for the fast reply.
>
> CORBA::Object_var nsobj = orb->resolve_initial_references("NameService");
> // after this line, variable nsobj is not NULL.
>
> CosNaming::NamingContext_var nc=CosNaming::NamingContext::_narrow(nsobj);
> // after this line, nc is also not NULL but a CORBA::INV_POLICY exception
> //apears in the Visual Studio Output window. I must also mention that the
> //execution continues even after the exception is thrown, leading me to
> //think it is being caught somewhere in MICO code.

Do not be that confused about INV_POLICY being displayed in VS. IIRC it 
displays also caught policies. If you are curious what's happening in 
this case is that _narrow attempts to open IIOP connection to target 
object and as part of this code there is also a logic which tries to 
obtain ContextEstablishmentPolicy from the target object reference. By 
spec, if such policy is not associated with the target object 
Object::_get_policy should throw CORBA::INV_POLICY exception which is 
caught and code continues... See iop.cc, and seek for 
MICO::IIOPProxy::make_conn (CORBA::Object_ptr obj, CORBA::Boolean& 
timedout) if you are interested in seeing the code in question.

> As for the demo/services/naming example, i've tested it and it seems to
> work. What i don't understand is that i'm trying to replicate the example
> with the same exact code except the if(CORBA::is_nil(<variable>)) part
> because both nsobj and nc variables are NOT NULL  i.e. 0x13f6d388.

Hmm. One thing is that nsobj and nc variables are NOT NULL from the C++ 
point of view. They are both _var smart pointers allocated statically on 
the stack so they should not be NULL anyway. The question here is if 
nsobj.in() and/or nc.in() are NULL or not, that means if the pointers 
saved into the smart pointers are null or not. That's why 
CORBA::is_nil(var) is usable here and I certainly recommend its usage 
here...

> I don't think there is smth wrong with argv[3] because with TAO it works
> just fine.

I still think this may be a culprit, if you don't believe try to use the 
same corbaloc in demo/services/naming example... Of course I may be 
mistaken here! But such is my instinct here... :-)

Karel
-- 
Karel Gardas                  kgar...@objectsecurity.com
ObjectSecurity Ltd.           http://www.objectsecurity.com

------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from 
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60134071&iu=/4140/ostg.clktrk
_______________________________________________
Mico-devel mailing list
Mico-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mico-devel

Reply via email to