[omniORB] bug making DynAny from any holding alias to sequence of obj refs

James Riden jamesr@harlequin.co.uk
17 Mar 2000 16:27:57 +0000


Hi,
Has anyone managed to reproduce this, or is it something peculiar to
my setup / omniORB build ?

thanks,
 James

On 13 Mar 2000 16:33:42 +0000 James Riden <jamesr@harlequin.co.uk>
wrote :
> Dear omniORBers,
> 
> I think I've found a problem with DynAnys in omniORB 2.8 (latest CVS
> checkout) on WinNT 4.0 / MSVC 5.0 SP 3. The following code illustrates
> this: 
> 
> usage:
>  collie% test.exe
>  'IOR:01234567890ABCDEF'
> 
> in a new shell window do :
> 
>  collie% client.exe IOR:01234567890ABCDEF
> 
> in the first shell I get:
> 
>  Caught omniORB2 fatalException. This indicates a bug is caught within
>  omniORB2. Please send a bug report.
>  The exception was thrown in file: ..\typecode.cc, line 962
> 
> The reason given is "TypeCode_base::NP_aliasExpand() - should not have
> been called".
> 
> cheers,
>  James
> 
> =====
> 
> // begin bug.idl
> 
> module BugTest {
> 
>   interface Foo {
>   };
>   
>   typedef sequence<Foo> Foos;
> 
>   interface FooServer
>   {
> 
>     void passFoos(in any myAny);
> 
>   };
> 
> };
> 
> // eof bug.idl
> 
> // begin test.cpp
> 
> #include "bug.hh"
> #include <omniORB2/omniORB.h>
> #include <omniORB2/CORBA.h>
> 
> #include <iostream>
> 
> using namespace std;
> 
> static  CORBA::ORB_ptr orb;
> 
> class FooImpl : public BugTest::_sk_Foo
> {
> public:
>   FooImpl()
>   {};
> 
>   ~FooImpl()
>   {};
> };
> 
> class FooServerImpl : public BugTest::_sk_FooServer
> {
> public:
>   FooServerImpl()
>   {};
> 
>   ~FooServerImpl()
>   {};
> 
>   void passFoos( const CORBA::Any& myAny )
>   {
>     try
>     {
>         CORBA::DynAny_var dyn_any = orb->create_dyn_any( myAny );
>     }
>     catch (omniORB::fatalException& ex)
>     {
>       cerr << "Caught omniORB2 fatalException. This indicates a bug is caught "
>            << "within omniORB2.\nPlease send a bug report.\n"
>            << "The exception was thrown in file: " << ex.file()
>            << ", line " << ex.line() << "\n" ;      
>     }
> 
>     return;
>   }
> };
> 
> int main(int argc, char **argv)
> {
>   orb = CORBA::ORB_init(argc,argv,"omniORB2");
>   CORBA::BOA_ptr boa = orb->BOA_init(argc,argv,"omniORB2_BOA");
> 
>   FooServerImpl* fooserver = new FooServerImpl();
> 
>   fooserver->_obj_is_ready(boa);
> 
>   BugTest::FooServer_var myobjRef = fooserver->_this();
>   CORBA::String_var p = orb->object_to_string(myobjRef);
>   cerr << "'" << (char*)p << "'" << endl;
> 
>   boa->impl_is_ready();
> 
>   return 0;
> }
> 
> // eof test.cpp
> 
> // begin client.cpp
> 
> #include "bug.hh"
> #include <omniORB2/omniORB.h>
> #include <omniORB2/CORBA.h>
> 
> #include <iostream>
> 
> using namespace std;
> 
> class FooImpl : public BugTest::Foo
> {
> public:
>   FooImpl() {};
>   ~FooImpl() {};
> };
> 
> int main(int argc, char **argv)
> {
>   CORBA::ORB_ptr orb = CORBA::ORB_init(argc,argv,"omniORB2");
>   CORBA::BOA_ptr boa = orb->BOA_init(argc,argv,"omniORB2_BOA");
> 
>   try {
>     CORBA::Object_var obj = orb->string_to_object(argv[1]);
>   
>     BugTest::Foo_ptr elt1 = new FooImpl();
> 
>     BugTest::Foo_ptr elt2 = new FooImpl();
>     
>     BugTest::Foo* foo_array[] = { elt1, elt2 };
>     
>     BugTest::Foos foos = BugTest::Foos( 1, 1, (BugTest::Foo **) foo_array );
> 
>     CORBA::Any myAny;
>     
>     myAny <<= (&foos);
>     
>     BugTest::FooServer_var my_obj = BugTest::FooServer::_narrow( obj );
>     
>     my_obj->passFoos( myAny );
>     
>   }
>   catch(...) {
>     cerr << "Caught exception." << endl;
>   } 
> 
>   return 0;
> }
> 
> // eof client.cpp
> 
> // begin makefile
> 
> OMNI=c:\ORBs\omni
> OMNIBIN=$(OMNI)\bin\x86_win32
> OMNILIB=$(OMNI)\lib\x86_win32
> 
> all:	bug test
> 
> bug:    bugSK.cpp
> 	$(OMNIBIN)\omniidl2 -a bug.idl
> 	cl -c -GX bugSK.cpp -D__x86__ -D__NT__ -D__OSVERSION__=4 -D__WIN32__ -I$(OMNI)\include -o bugSK.o
> 	cl -c -GX bugDynSK.cpp -D__x86__ -D__NT__ -D__OSVERSION__=4 -D__WIN32__ -I$(OMNI)\include -o bugDynSK.o
> 
> test:	test.cpp
> 	cl -GX $(OMNILIB)\omniDynamic280_rt.lib $(OMNILIB)\omniORB280_rt.lib $(OMNILIB)\omnithread2_rt.lib test.cpp bugSK.obj bugDynSK.obj -D__x86__ -D__NT__ -D__OSVERSION__=4 -D__WIN32__ -I$(OMNI)\include 
> 
> client: client.cpp
> 	cl -GX $(OMNILIB)\omniDynamic280_rt.lib $(OMNILIB)\omniORB280_rt.lib $(OMNILIB)\omnithread2_rt.lib client.cpp bugSK.obj bugDynSK.obj -D__x86__ -D__NT__ -D__OSVERSION__=4 -D__WIN32__ -I$(OMNI)\include 
> 
> // eof makefile
> 
> 
> -- 
> James Riden
> jamesr@harlequin.co.uk
> 

-- 
James Riden / jamesr@harlequin.co.uk / jamesr@europe.com
http://www.distributed.net/ because CPU cycles are a terrible
thing to waste