[omniORB] omniORB 3.00pre1 problem with _is_a (_real_is_a)

David Riddoch djr@uk.research.att.com
Mon, 22 Nov 1999 10:02:34 +0000 (GMT)


On Mon, 22 Nov 1999, Christof Meerwald wrote:

> >> As I understand it, _real_is_a shouldn't return 0 without calling
> >> _remote_is_a.
> 
> There seems to be a related problem in omniInternal.cc (omni::createObjRef,
> line 558):
> 
>   proxyObjectFactory* pof = proxyObjectFactory::lookup(mostDerivedRepoId);
> 
>   if( pof && !pof->is_a(targetRepoId) &&
>       strcmp(targetRepoId, CORBA::Object::_PD_repoId) ) {
>     if( omniORB::trace(10) )
>       omniORB::logf("Cannot create reference -- %s is\n"
>                     " not a base for %s.", targetRepoId, mostDerivedRepoId);
> 
> 
> This returns a nil reference if the information supplied in
> mostDerivedRepoId isn't really the most derived interface (e.g. if
> mostDerivedRepoId says omg.org/CORBA/Object but it really is a more derived
> interface)

The point here is that we do have static compile time knowledge for
'mostDerivedRepoId', and it is not a subclass of 'targetRepoId'.
Therefore we cannot create a reference of type 'targetRepoId' to this
object which is of an unrelated type 'mostDerivedRepoId'.  We only fail if
we know that this cannot be correct. If we do not know the inheritance
relationship between the two interfaces we would give it the benefit of
the doubt.

There is however one case where this might give the wrong answer.  If the
object has been replaced by one of a more derived type which does have
'targetRepoId' as a base class (as well as 'mostDerivedRepoId') then we
would fail to create the reference even though the object does now support
the desired interface.  However we cannot be expected to know this at the
client, and I think it is perfectly acceptable to fail here.

Cheers,
David