[omniORB] Extracting exceptions from Any
duane@router.econz.co.nz
duane@router.econz.co.nz
Fri, 03 Mar 2000 15:41:26 +1300
Hi, I'm not sure if this is known and/or has been fixed, but it appears
that the omniORB 2.8.0 omniidl2 compiler has a bug in the code it
generates for the operator extracting exceptions from an Any.
If you define an exception in a module like this:
module a {
exception ExceptionA {
};
};
Using omniidl 2.8.0 with the -m and -a flags it generates a header file
declaring the extraction operator like this:
CORBA::Boolean operator>>=(const CORBA::Any& _a, a::ExceptionA*& _sp);
But in the cc file it defines the operation like this:
CORBA::Boolean operator>>=(const CORBA::Any& _a,const a::ExceptionA*&
_sp) {...} (Note the const)
Which means that when you go to extract an exception from an Any:
a::ExceptionA *exceptionA;
if (exc.exception() >>= exceptionA) {...}
It complains about unresolved references. If you either add const to the
operator declaration in the header file, or remove it from the operator
definition in the cc file it seems to work. Taking a quick look at the
spec it appears that both forms should be provided, but the non-const
form is deprecated, so it would probably be better to use the const
form. Applying the following patch will make the change:
===================================================================
Index: src/tool/omniidl2/omniORB2_be/o2be_exception.cc
933c933
< IND(s); s << "CORBA::Boolean operator>>=(const CORBA::Any& _a, "
---
> IND(s); s << "CORBA::Boolean operator>>=(const CORBA::Any& _a, const "
Cheers,
Duane.